• Awesome script by Lowell.

    I quick questions, if in a server multiple database mail accounts are configured. How to ensure which are the db mail accounts?

    If I run :=

    select * from msdb.dbo.sysmail_profile

    It will throw details of operators, dbmail.

    But if I run the below one, it is showing the mail accounts.

    SELECT *

    FROM msdb.dbo.sysmail_profileaccount pa

    JOIN msdb.dbo.sysmail_account a ON a.account_id=pa.account_id

    =I need to clean up all the duplicate/junk/extra dbmail accounts from multiple servers and looking for a std T sql to identify only the DBMAIL accounts which I 'll use in my procedure to clean them up across servers

    Please suggest with your valuable advise.

    Thanks.