the_mullet


Here's the scoop, and I've seen several posts to this effect but none of the solutions have worked.

Enabled database mail. confirmed profiles and can send test database mail from Query Window. I can also right click Database mail and send test emails. Configured valid operator using same email address for the test emails above.

Enabled database mail profile under SQL Agent properties > Alert System.

From what I've seen, the test button is supposed to be greyed out, and it is. However alerts do not send emails operator.

I've done this

http://msdn2.microsoft.com/en-us/library/ms186358(SQL.90).aspx

and this

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=322173&SiteID=1

and have bounced the Agent after each change but still no mail from the Agent.

I've tried select * from sys_mail_event_log no errors.

For the life of me, I can't see why the Agent won't send mail.

Help.




Re: SQL Agent won't send database mail

Amit Banerjee - MSFT


Hi,

For SQL Agent to send mail using SQLMAIL feature. (Have you done this following the instructions given in the link: https://msdn2.microsoft.com/en-us/library/ms189620.aspx). In case you are using 64-bit version of SQL Server 2005, then SQL Mail is a not a feature available for SQL Server 64-bit versions.

Also, if you are using Database Mail, have you configured and set up your database mail with a SMTP account. Please refer http://msdn2.microsoft.com/en-us/library/ms175887.aspx

Also, if the above two have been done, the please try the following:

If you are using SQL MAIL and this is a 32-bit installation, then try sending a mail using xp_sendmail (http://msdn2.microsoft.com/en-us/library/ms189505.aspx) and check if you are receiving it.

If you are using DB Mail, then check if you are receiving email using the SP sp_send_dbmail (http://msdn2.microsoft.com/en-us/library/ms190307.aspx)

Also, make sure that the SQL Server Agent Startup Account has the necessary priveleges to call that SP. Essentially, the SQL Agent startup account should have sys admin privileges on the box.

HTH







Re: SQL Agent won't send database mail

Hmarques Tuga

Hi all.
Exactly the same problem here...

Everything double-checked.

The curious part is that when i use your suggestion above it worked.
If you are using DB Mail, then check if you are receiving email using the SP sp_send_dbmail (http://msdn2.microsoft.com/en-us/library/ms190307.aspx)

After checking agent logs, iĄ¯ve seen this:
[364] The Messenger service has not been started - NetSend notifications will not be sent

How in the hell can I start this service



The "DB Mail" profile is the only one active in Sql Server, is enabled for the agent...


Any help appreciated





Re: SQL Agent won't send database mail

Hmarques Tuga

Hi again.

Solved.

Windows Server 2003 uses the Messenger service to send notifications, but this service is disabled by default.

I started the Messenger service, restarted the SQL Agent and itĄ¯s working just fine




Re: SQL Agent won't send database mail

the_mullet

I've since got it fixed. Our SMTP server didn't require credentials, so the setup of the profile was correct.

Basically, I had a momentary lapse of brain death. Once I bounced the Agent service after enabling database mail I expected some time of email since all the tests delivered email messages as expected.

Once my alerts began to fire, then I received Agent notification. Apparently, the database mail service is only started when the Agent tries to send mail, and then shuts down again once the entire mail process is complete.

Thanks all for your assistance.