Friday, February 24, 2012

Database Mail Fails For SQL Server Agent Jobs

I'm having a problem with database mail in SQL Server 2005. I have set up a default profile and been able to successfully send test emails. The problem occurs with notifications for sql server agent jobs. I've set up email notifications for when certain jobs fail, but the emails aren't being sent. The following errors show up in the sql server agent log:

"Message
[264] An attempt was made to send an email when no email session has been established"

I tried re-starting the sql server agent and the following message appeared in the log:

"Message
[355] The mail system failed to initialize; check configuration settings"

Both the SQL Server Database and SQL Server Agent are running with the same domain account. I've set SQL Server Agent to send emails through the default Database Mail profile (set under the "Alert System" tab). Any help would be greatly appreciated. Thank you.

If you see this on 64 bit environment, we have a tracking bug for this.

This is planned to get addressed for our next public release.

The workaround would be to use SQLAgent mail on 64 bit environment.

Please refer to KB article # 908360 for more information.

Thanks,

Gops Dwarak

|||I am experiencing the same problem you are having, so I would like to know if you resolved it and what you did to resolve it. I would appreciate your feedback. Thank you.|||

Please refer to KB article # 908360 for work around.

SP1 address this bug

Till then using SQLAgent profile for sending mails for notifications is the workaround

If you want to use DBMail profile to send notifications for job runs, the workaround would be to add a TSQL job step as the last step to the job that will call sp_notify_operator.

Hope this helps!

Thanks,

908360

|||

I have the same error no matter which email method I use. Help me get SP1 please.

Thanks

Sam

|||

Hi,

I have come across the same problem and got resolved by enabling mail session in SQL Server Agent and it is working fine after restarting the SQL Agent.

Pramod

|||

Hello,

I'm getting the same problem. The only issue is we have 3 cluster servers running 64-bit and, for some reason, the one that is running most of the jobs and is the distributor for our replication, cannot send an email via job notification. The other two clusters work fine.

We have dropped and added everything a couple of times and restarted SQL Server Agent. I checked and the SQL Server Agent is running under the domain account. But we still get "[264] An attempt was made to send an email when no email session has been established" in the SQL Server Agent log. Also have a "[355] The mail system failed to initialize; check configuration settings" error, but I was playing with switching it to SQLMail, so this might be erroneous.

Any help would be appreciated.

|||Never mind. I just noticed the version on the cluster that is failing is 1399, not 2047.|||I am getting the same error on one of two identical servers, one works one does not.
I get "[355] The mail system failed to initialize; check configuration settings" when I restart the SQL Server Agent and
"[264] An attempt was made to send an email when no email session has been established" when I have a job run that is set to notify the operator on completion.

I am running the following:
Microsoft SQL Server 2005 - 9.00.1399.06 (X64) Oct 14 2005 00:35:21 Copyright (c) 1988-2005 Microsoft Corporation Standard Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)

I setup Database Mail and my operator exactly the same on both servers, I enabled the Mail profile under the "Alert System" tab in the SQL Server Agent properties window. I can successfully send a test message from the Database Mail object under Management.

I'm running out of ideas.

No comments:

Post a Comment