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


I am running SQL Server 2005 SP3 and I have a problem with receiving email notifications.
I setup a Database profile and when I send out a test email then I receive it. I then enabled the mail profile in the SQL Server Agent  properties but in there the test button is greyed out.

After all of this I created an SQL JOB and configured to receive notifications if the jb fails. Well the emails are never being send out. When I check the SQL Server Agent logs then I find the errors below with time stamps when the email should be send out:
Date            4/25/2010 8:03:24 PM
Log            SQL Agent (Current - 4/25/2010 8:03:00 PM)

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

I looked here in the forum but I was not able to find any useable solution.

Can anyone help please?

Thank you
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TRy this:

1. Uncheck "Enable mail profile" on SQL agent properties/Alert system
2. Stop SQL Agent
3. Start SQL Agent
4. Enable database mail in the properties
5. Stop SQL Agent
6. Start SQL Agent


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mc2102Author Commented:
Hello bchoor,

I just followed your procedure.  Now when I execute the job manually and it fails it should send me a notification as well right?
It should - Is it giving any errors? Can you do a try catch exception around the send mail command and insert the exception_message into an exception table? that way we can see what issue is occurring - when you do it manually.



  EXEC msdb.dbo.sp_send_dbmail @profile_name = 'aaa', '@recipients = 'someone@co.com', @body = 'Job did not complete', @subject = 'Job did not complete'
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

If the emails are coming from SQL SErver Agent (i.e. notifications per job status) , then it won't unless you force the job to run through SQL SErver agent.
Mc2102Author Commented:

I just ran my job again and made it fail in intention and everything worked. The email notification was send out.

The fix is a little odd but it worked. So thank you very much.
Mc2102Author Commented:
Worked! Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.