SQL Server Agent (no email upon job failure)

  • Hello,

    Hope someone can help  me here.
    I'm running SQL Server 2012 with service pack 4 installed.  I have my Database Mail set up correctly, I get the test email fine.  On SQL Server Agent under properties, Alert System i checked the "enable mail profile" box and selected the correct mail profile.  On my jobs, under notifications i checked the email box with my operator name and set email to alert when job fails.  Still no email.

    Test works fine, but when the actual job fails, i get no email.

    I tried the same thing on my local machine, just using local db and it all works, but I can't get it to work on my server. Any thoughts?

    Thank You  in advance...

  • Only one, check sent items and if sent get mail admin to check logs. You may also want to try the same thing in ssms.

    ...

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

  • Did you restarted Agent Service after making that change under your SQL Agent properties?

  • Yes i restarted the Sql Server Agent, I restarted the server it self, stopped and restarted the service too, no luck.  

    It's really strange since, like I said, it works fine on my laptop by just setting up test job on a local db.

  • Right click Database Mail - View Database Mail Log, post a few samples if you require further assistance.

    Also, how many recipients are you using in the normal notification (as opposed to your test)? I believe there is a limit on the number of characters.

  • Hi RandomStream,

    I only have one recipient set up.Database mail log has a ton of these: "01/10/2018 15:27:32,,Error,170540,The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2018-01-10T15:27:32). Exception Message: Cannot send mails to mail server. (Failure sending mail.).
    ),2204,117310,,1/10/2018 3:27:32 PM,sa"

  • asinanovic - Thursday, January 11, 2018 10:46 AM

    Hi RandomStream,

    I only have one recipient set up.Database mail log has a ton of these: "01/10/2018 15:27:32,,Error,170540,The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2018-01-10T15:27:32). Exception Message: Cannot send mails to mail server. (Failure sending mail.).
    ),2204,117310,,1/10/2018 3:27:32 PM,sa"

    It could be related to the Profile and permissions. Whatever the profile is you are using, try setting it to public and see if it works.

    Sue

  • Are you using a public (e.g. gmail) or private mail server (e.g. exchange)? Does it require and have you checked SSL? Could it be that you need to specify an alternate port?

    Although you said test mail worked but we have to ask. You may need to ask your sys admin if AD account and Exchange are involved.

  • Hi Sue,

    I tried that already, didn't work :(.

  • asinanovic - Thursday, January 11, 2018 11:03 AM

    Hi Sue,

    I tried that already, didn't work :(.

    I can't remember what version of SSMS this applied to but on one of them it seemed that several people hit an issue like this and to resolve it they removed the enable email and such from the Agent properties. Restarted Agent. Then went back and enabled mail, add the profile and then restarted Agent. Probably worth a try at this point.

    Sue

  • RandomStream - Thursday, January 11, 2018 11:01 AM

    Are you using a public (e.g. gmail) or private mail server (e.g. exchange)? Does it require and have you checked SSL? Could it be that you need to specify an alternate port?

    Although you said test mail worked but we have to ask. You may need to ask your sys admin if AD account and Exchange are involved.

    Using an exchange server and AD yes. 
    And it works if i set it up on my laptop, which in on the same domain, and using the same exchange server as my SQL server.
    Don't know.

  • Sue_H - Thursday, January 11, 2018 11:08 AM

    asinanovic - Thursday, January 11, 2018 11:03 AM

    Hi Sue,

    I tried that already, didn't work :(.

    I can't remember what version of SSMS this applied to but on one of them it seemed that several people hit an issue like this and to resolve it they removed the enable email and such from the Agent properties. Restarted Agent. Then went back and enabled mail, add the profile and then restarted Agent. Probably worth a try at this point.

    Sue

    I did see a lot of people online posting about this, and the solution was as simple as restarting the SQL Server Agent.  Doesn't work for me, I just tried again what you suggested and nothing.  If i ever do figure it out I'll let you know.

  • asinanovic - Thursday, January 11, 2018 11:14 AM

    RandomStream - Thursday, January 11, 2018 11:01 AM

    Are you using a public (e.g. gmail) or private mail server (e.g. exchange)? Does it require and have you checked SSL? Could it be that you need to specify an alternate port?

    Although you said test mail worked but we have to ask. You may need to ask your sys admin if AD account and Exchange are involved.

    Using an exchange server and AD yes. 
    And it works if i set it up on my laptop, which in on the same domain, and using the same exchange server as my SQL server.
    Don't know.

    Confirm with the team that supports the email server whether or not you have to add the server to the white list to allow that server to send email through the SMTP gateway.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • An off the peg thought, has the agent service account been changed at all?

    ...

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic. Login to reply