Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

Troubleshooting SQL Server Database Mail not sending emails

30 April,2018 by Tom Collins

Question: The Database Mail component is not send emails. The emails are registering – but remain in the “unsent” status.

I’m running SQL Server 2016 . How can I troubleshoot this issue

Answer: Here are some techniques to assist you in gathering information. I’ve experienced this problem a few times – always different reasons.

 

--check database mail status

sysmail_help_status_sp

 

--delete mailitems

DECLARE @GETDATE datetime

SET @GETDATE = GETDATE();

EXECUTE msdb.dbo.sysmail_delete_mailitems_sp @sent_before = @GETDATE;

 

--stop start database mail

EXEC msdb.dbo.sysmail_stop_sp;

EXEC msdb.dbo.sysmail_start_sp;

 

--check status

EXECUTE dbo.sysmail_help_status_sp

 

--check items

SELECT * FROM sysmail_allitems

 

One problem I’ve experienced is a missing .Net 3.5 on Windows 2016 \ SQL Server 2016 CU1 set up. When Database Mail attempts to send an email it activates the /bin/Databasemail.exe . Databasemail.exe requires .Net 3.5 – you can check this by comparing a server which has the Databasemail.exe component working properly.

If you attempt to execute Databasemail.exe and .Net 3.5 is not installed – a message will pop up asking for .Net 3.5

Once I installed .Net 3.5 – and restarted SQL Server – Database Mail started sending OK

Microsoft published a FIX for this issue on : FIX: SQL Server 2016 Database Mail does not work on a computer that does not have the .NET Framework 3.5 installed

 

Read More on Database Mail

SQL Server - Sp_send_dbmail and bcc

Generate query results and attach to email using SQL Server ...

SQL Server – Send email using Powershell - SQL Server DBA

Send email from Powershell with attachment - SQL Server DBA

 


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Troubleshooting SQL Server Database Mail not sending emails


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer