Contact us

Madeira Data Solutions

Your Data, Our Solutions

How to troubleshoot database mail?

Written By: Nathan Lifshes 25/12/2017

If after creating a DB Mail Profile and an account you send a test email and it doesn’t work, you can try these steps to troubleshoot it:

  1. Look for error messages in the database mail log: “SELECT * FROM msdb.dbo.sysmail_event_log;”
    A couple of common problems that you might encounter here are: authentication issue (due to incorrect mail configuration such as username/password, or incorrect ports, SSL settings and so on), or the mail server being unreachable (usually due to Firewall settings).
  2. Check that the database mail status is started: “EXEC msdb.dbo.sysmail_help_status_sp;” 
    If it’s not, you can use the sysmail_start_sp procedure to start it.
  3. Check mail queue state with “EXEC msdb.dbo.sysmail_help_queue_sp @queue_type = ‘Mail’ ;”
    You can use this procedure to see how many items are in the queue, the status of the queue, and when it was last activated.
  4. Try to find “DatabaseMail.exe” in the task manager or disk and execute it.
  5. Windows can pop up error messages like “this app requires .NET Framework 3.5“, strange, but it offers to install it. Click Ok.
  6. Restart the SQL Server service.
  7. Mail queue is empty. All mail sent.
  8. Success!!!

Leave a Reply

Your email address will not be published. Required fields are marked *