Thursday, November 20, 2014

SQL Commands related to Database Mail

Basic SQL commands to know related to Database Mail, I am just keeping them for quick reference.

SELECT * FROM sysmail_log
           
-- Get all Sys mail accounts by running the below statement       
        SELECT * FROM sysmail_account
       
--If you want to find all the mails which by a particular Login...
        SELECT * FROM sysmail_sentitems
        WHERE send_request_user = 'LoginName'

        -- You can use above for today item List too..

-- If you want to see all failed items through Database mail                        
        SELECT * FROM sysmail_faileditems
        --WHERE send_request_user = 'LoginName'

       

-- List all the principle profiles in the server
SELECT * FROM sysmail_principalprofile
-- List all the profiles in the server
SELECT * FROM sysmail_profile

SELECT * FROM sysmail_profileaccount
-- You can see the existed SMPT server names, Port number by running the following
SELECT * FROM sysmail_server

No comments:

Post a Comment