Wednesday, August 5, 2009

SQL: An attempt was made to send an email when no email session has been established

Trying to setup job notification and keep getting the error:
An attempt was made to send an email when no email session has been established
even the Mail test is succesfull??

I know the answer!)
Seems that you having defaultDatabase Mail Executable Minimum Lifetime- 600sec
and probably your job requires more than 10 minutes mail server lifetime.
You can change the setting:
Under your sql server - Management - Database mail - Configure - view or change system settings...

But still there is a question - what if the email activity happens on the server only once a day - how we can open an email session instead keeping open the old one?