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

    Dotaz

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

    is the error I get when I try to send mail on the database.

    It is a SQL Server 2005 Standard edition. I have configured database mail and tested it and it works there, then I configured a database operator. then I just created a test job to notify the operator of the job completion, and the email fails.

    Any ideas?

    Ryk

    14. prosince 2005 5:26

Odpovědi

Všechny reakce

  • Have you gotten a respone or found out why you where having the problem. Im currently having the same issue.
    17. ledna 2006 20:34
  • I have the same issue.
    8. února 2006 20:45
  • I think I found the solution. I restart the SQL agent and the notification finally works now.
    • Navržen jako odpověď oky111 16. dubna 2009 14:50
    • Označen jako odpověď Kalman TothEditor 23. října 2009 8:24
    8. února 2006 21:10
  • Are you using RTM version ?

    It should not require to restart SQLAgent. Let me follow up on this and if this is the case we will try to get this address in future release.

    Thanks,

    Gops Dwarak

    10. února 2006 5:55
  • I am running WorkGroup edition full verison and am getting this error.

    After restarting the SQLAgent it works.

    20. února 2006 20:13
  • Hi,

    I had the same problem running  SQL Server 2005 Standard Edition on
    Windows Server 2003 SP1 Standard Edition.

    I did the following:
     1. Installed/Configured Database Mail.
     2. Setup SQL Server Agent to use the Profile under the alert system tab.
     3. Created an operator.
     4. Created a job that would fail (select * from from tblBlah), and set to email my operator on failure.

    Got the error listed above.

    After numerous atttempts

    5. Restarted SQL Server Agent.

    Now it works :-)

    Cheers
    John
    22. února 2006 5:51
  • Hi,

    I'm running SQL 2005 enterprise edition on Windows 2003 SP1.

    I have restarted many times the Server Agent or resinstalled the  database mail but I still have the same problem. But when I use the stored procedure " xp_sendmail" I have no problem. The email is sent. All tests are successfull. When I run a job no  email is sent to the operator . It doesn't works. Please tell me where is the problem?

    5. března 2006 21:56
  • Gops,

    Just curious if you have heard anything else regarding this issue?

    I have run into a similar problem running SQL Server 2000 sp3 on Win Server 2003 sp1.

    I had setup email properly, it was sending emails and then suddenly stopped.  After restarting the SQLAgent, the email began to work properly again with making no changes to any system settings.

    Thanks,

    David.

    10. března 2006 16:05
  • You also have to enable mail profile located in the properties of the SQL Agent, Alert System.
    29. června 2006 15:32
  • SQL Mail for SQL 2000 is VERY different that Database Mail for SQL Server 2005. We intermittently have issues with SQL Mail and I'm not surprised that restarting the agent service resolved the issue (at least temporarily!).

    Michelle
    29. června 2006 18:33
  • I had the same problem. 64-bit, Enterprise Edition sp2 on Windows 2003 sp1. At first I thought that sp1 didn't really fix database mail for this configuration and I tried to use the KB article explaining how to set up sql mail but it had some mistakes. When that didn't work either - I restarted the sql server agent, they both worked, and I scrapped sql mail in favor of database mail.

    Michelle
    29. června 2006 18:42
  • I have SQL 2005 Std SP1 on Windows Server 2003 SP1.  Setup Database Mail, tested OK, was able to send mail using sp_send_dbmail.  I have same problem that the the notification email was not sent out when a job is completed.  In Database Mail Log it had a message:

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

    Also in Property of SQL Agent, when I enabled mail profile the Test button was grayed out.  I think it was not appliable for DB mail but just wanted to check if this is right.

    I have tried to disable and eable Database Mail couple times, restarted SQL Agent, restarted SQL server.  There was no help.  I searched and found that a lot of people having this kind of problem and so far no real fix for it.  Restarting SQL Agent doesn't help for me.  I don't want to go back to SQLMail but Database mail is tricky.  Does anyone know how?

    7. listopadu 2006 18:00
  • I had the same problem but was able to make it work using tips from this web site.

    I have W2k3 Standard Server SP1, SS2K5 Standard SP1. Both SS (SQL Server) and SSA (SQL Server Agent) run with Local System account, automatic start up.

     

    1. Configure Database Mail. Create the profile, specify your smtp server, follow other steps, test it. If the test was sucessful, you are half way there.

    2. Create Operator(s)

    3. Configure SSA to use the profile you created when configuring Database Mail. Right click SSA --> Properties --> Alert System, check Enable Mail Profile, verify you have Database Mail for Mail system selected, verify you have your profile selected in Mail profile drop-down box. The TEST button will be greyed out. It is for SQL Mail test (I think). At this point I had to restart SSA. Otherwise the last steps failed for me. Microsoft says we shouldn't have to restart the SSA but that was not the case in my situation.

    4. Create your Maintenance Plan or SSA jobs. In the Maintenance Plan add Notify Operator Task, save the plan. Execute it. If you did not use the Maintenance Plan and instead simply created the job, then in the Notifications tab (Job --> Properties --> Notifications), check the box for e-mail, select an Operator, and when the notification should be sent.

    I prefer to use Maintenance Plan for the notificatioin purpose as it is more flexible and gives more options.

    9. listopadu 2006 17:35
  • I got it worked for me but here is the tricky part: it must be done in SQL SAC.  I restarted SQL Agent using services.msc and SQL Management Studio: neither one worked.  I kept googoling and tried to use SQL Surface Area Configuration; it worked.

    So what is the difference here?

     

    9. listopadu 2006 19:20
  • sql agent restart solved it for us, too.  thanks.

    30. října 2007 15:56
  •  

    Hey all, this happened to me too.  I recently did a migration to SQL Server 2005 and am setting up the alerts that I had going on 2000.  I did the same thing as hthan said here.  I tried to restart the agent in SSMS but it didn't change anything.  Finally, I

     

    1.  Logon to sql server using remote desktop

    2.  go to start.programs.Microsoft sql server 2005.SQL Server Configuration Manager

    3.  restart the agent for the instance  

    7. listopadu 2007 23:49
  •  

    Thanks All , Restart agrent thing worked for me ...
    5. prosince 2007 2:59
  • I know there haven't been any posts to this topic in a long time, however since I just had this happen to me

    on x64 SP2 the issue is still around and the KB articles are a bit misleading.

     

    Article http://support.microsoft.com/kb/908360/ suggests configuring SQL Mail. I highly suggest the

    stopping and restarting before doing that.

     

    -Mark

     

     

    28. dubna 2008 11:55
  • I am having similar issue with x64 - all settings are in place, but the job doesn't send the e-mail notification to the operator.SSA has been configured and restarted. Anyone has any ideas how to fix it w/o using Outlook Express account? Can regular Outlook account be used instead? Anyone tried that?

     

    28. května 2008 15:37
  • Thanks! This worked for me.
    8. ledna 2009 15:47
  • I completed all steps specified by jcrawfo2. It is works.
    Thanks
    22. ledna 2009 19:31
  • John's suggestion did worked.
    Thanks,
    ~AV
    21. února 2009 22:23
  • Hi there,

    I have tried all the proposed solutions on this issue, unfortunately none of them did the trick.

    Our System:
    We are running a Win2003 Std 64x with SP2
    SQL Server 2005 Enterprise 64x (latest SP's)
    2 Instanses: Default (MSSQLSERVER) and a named one.

    The send "notification email when job fails" works perfectly on the default instance, but not on the named one.
    I have really tried everything that was suggested from restarting the SQL Agent Service (both instances), restarting the server, recreating multi operators.
    I also set the SQL Agent to use the db mail profile for alerts.

    Although when I run the sp_send_dbmail it does work fine, but not through the job.

    Your help will be really appreciated with this,

    Thanks very much

     

    17. dubna 2009 9:03
  • You mentioned that "Although when I run the sp_send_dbmail it does work fine, but not through the job.". Are you trying to run a T-SQL job in SQL Agent to send an email?
    In this case,
    - check if the Agent service account has permissions to send database mail 
    - does the job has any proxies defined?


    If your goal is to send result of job execution through email, please take a look at following steps

    Can you check is the following registry value has the profile name that was set through SQL Management Studio?
    Below registry key is for default instance.
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\SQLServerAgent\DatabaseMailProfile

    You would see a similair registry key for named instance like  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.<instance_id>\SQLServerAgent\DatabaseMailProfile


    Could you try the following sequence
    1) Stop SQL Server Agent
    2) Stop SQL Server Service
    3) Open windows Task manager and check if there are any running processes like DatabaseMail90.exe.  If any, you can wait till they shutdown themselves or end those processes using taskmanager
    4) Restart SQL Server, Agent
    5) Send a test mail using sp_send_dbmail using a specific profile name
    6) Create a new operator with a valid email address
    7) Create a Agent job, in "Notifications" page, select Email  and pick  the operator from the list, select option to send email when job completes
    8) Now start the job and check for any errors, also check DBMail logs to see if there are any failure messages

    Let us know if are not able to receive emails after job execution completes

    Thanks
    Sethu Srinivasan[MSFT]
    SQL Server Manageability
    http://blogs.msdn.com/sethus

    This posting is provided "AS IS" with no warranties, and confers no rights.

    20. dubna 2009 18:21
    Moderátor
  • This issue will be resolved by SP 1.
    Although we ran the SP updates, it only updated the default instance. So the named was still in RTM state.

    Make sure you update the correct instance ;)
    • Navržen jako odpověď El_Kiddo 21. dubna 2009 9:38
    21. dubna 2009 9:38
  • I ran across this forum with the same issue, here are the steps I took to resolve, a slightly different order than earlier postings:

    SQL2005
    1. Select SQL Server Agent, right click
    2. Select properties
    3. Select alert system
    4. Under Mail Session, check enable mail profile  (be sure the profile was set up in Database Mail, under management
    5. Select OK
    6. Stop SQL Server Agent
    7. Restart SQL Server Agent

    This is what solved it for me.

    • Navržen jako odpověď Flea_ 10. listopadu 2010 16:07
    9. září 2009 20:13
  • Rebboot the DB-SQL-Agent after you created the operator, that should work.

    24. září 2009 15:39
  • Tks for your answer I fix the problem fallow your steps.

    Regards
    21. října 2009 21:10
  • Restarting SQL Server Agent is definately the one, after creating an operator.
    28. listopadu 2009 3:17
  • Thanks, ATK25, this was the missing link for us! 

    3.Select alert system
    4. Under Mail Session, check enable mail profile 

    3. května 2010 20:19
  • I ran across this forum with the same issue, here are the steps I took to resolve, a slightly different order than earlier postings:

    SQL2005
    1. Select SQL Server Agent, right click
    2. Select properties
    3. Select alert system
    4. Under Mail Session, check enable mail profile  (be sure the profile was set up in Database Mail, under management
    5. Select OK
    6. Stop SQL Server Agent
    7. Restart SQL Server Agent

    This is what solved it for me.


    This is useful to me ,thanks!
    13. července 2010 5:55
  • ATK25's solution worked for me!  Thank you!
    10. listopadu 2010 16:09
  • ATK25's solution worked for me!  Thank you!

     

    Me too!

    27. dubna 2011 16:49
  • it worked for me. thanks. very clear instructions.... :)
    • Navržen jako odpověď Ted Gordon 15. března 2012 21:21
    16. června 2011 1:14
  • running Windows Server 2008 R2 and SQL Server 2008 R2 Web edition.

    In SSMS I went to SQL Server Agent properties, enabled SQL Server agent mail profile under alert system. I had to restart SQL Service Agent service in SQL Server Configuration Manager.

    Worked like a charm.  Made me happy.

    15. března 2012 21:26
  • I've also had the same behavior on SQL Server 2008 (Enterprise) and SQL Server 2008r2 (Standard). As others have posted, after Enabling the mail profile under SQL Server Agent properties/Alert System, I still needed to restart the SQL Server agent before any job notification emails were sent.

    GT

    27. března 2012 16:41
  • Hi John,

    Fantastic answer!  I was having the same problems, followed your advice and now it works seemlessly.

    The one thing I would like to point out though is that the restart of the Server Agent is only required the once to account for the setting of the profile under your serial 2.  Once it has been restarted the once it is not required to have to do it again unless another profile is to be used.

    Many thanks for your input!

    Regards,

    Kev

    14. listopadu 2012 15:06