locked
Server 2008 - Task Scheduler - Send an E-mail fails RRS feed

  • Question

  • When ever we set an action to send an E-mail in the Server 2008 Task Scheduler GUI, we get a "Task failed" result of
    "Cannot modify or delete an object that was not added using the COM+ Admin SDK (0x8004020D)  once the task gets to that step.

    I have tried creating tasks that do nothing but try and send an email using the new functionality of the Task Manager and it fails with the exact same error, So I have narrowed it down to the email action being the culprit.  As soon as I remove it from the other tasks, everything works as planned.

    Is there a fix for this?  Is there a permission I need to set somewhere?  It seems that some people have tried running the task as the "Network Service" and it works, but I have had no such luck yet.



     
    Friday, September 5, 2008 4:15 PM

Answers

  •  

    Hi,

     

    If a task attempts to send an e-mail, but the e-mail doesn't get sent correctly, first make sure that the settings for the e-mail action on the task are set correctly. The e-mail action must have a valid value for the SMTP server, To, and From settings. For more information about these settings, please refer to the following article:

     

    Actions

    http://technet.microsoft.com/en-us/library/cc722129.aspx

     

    Make sure the SMTP server that sends the e-mail is setup correctly. E-mail is sent using NTLM authentication for Windows SMTP servers, which means that the security credentials used for running the task must also have privileges on the SMTP server to send e-mail. If the SMTP server is a non-Windows based server, then the e-mail will be sent if the server allows anonymous access.

     

    For information about setting up the SMTP server, please see the following article:

     

    SMTP Server Setup

    http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e4cf06f5-9a36-474b-ba78-3f287a2b88f2.mspx?mfr=true

     

    And for information about managing SMTP server settings, please see the following article:

     

    SMTP Administration

    http://technet.microsoft.com/en-us/library/cc758258.aspx

     

    Hope it helps.

     

    Tim Quan - MSFT

    • Marked as answer by Tim Quan Thursday, September 11, 2008 2:11 AM
    Monday, September 8, 2008 8:35 AM

All replies

  •  

    Hi,

     

    If a task attempts to send an e-mail, but the e-mail doesn't get sent correctly, first make sure that the settings for the e-mail action on the task are set correctly. The e-mail action must have a valid value for the SMTP server, To, and From settings. For more information about these settings, please refer to the following article:

     

    Actions

    http://technet.microsoft.com/en-us/library/cc722129.aspx

     

    Make sure the SMTP server that sends the e-mail is setup correctly. E-mail is sent using NTLM authentication for Windows SMTP servers, which means that the security credentials used for running the task must also have privileges on the SMTP server to send e-mail. If the SMTP server is a non-Windows based server, then the e-mail will be sent if the server allows anonymous access.

     

    For information about setting up the SMTP server, please see the following article:

     

    SMTP Server Setup

    http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e4cf06f5-9a36-474b-ba78-3f287a2b88f2.mspx?mfr=true

     

    And for information about managing SMTP server settings, please see the following article:

     

    SMTP Administration

    http://technet.microsoft.com/en-us/library/cc758258.aspx

     

    Hope it helps.

     

    Tim Quan - MSFT

    • Marked as answer by Tim Quan Thursday, September 11, 2008 2:11 AM
    Monday, September 8, 2008 8:35 AM
  • I'm using a third party email server and having problems. This is what I see in the logs:
    "2009-04-06 21:04:58 127.0.0.1 SMTP-IN  127.0.0.1 460 AUTH AUTH+LOGIN 334+RANDOMSTRING COMPUTERNAME 18 12  "

    I'm allowing relaying for 127.0.0.1 but have also enabled windows authentication in addition to it's built in authentication since it looks like Task Manager is attempting to authenticate. But I have no idea what the random character string is in the logs, is that meant to be the username? Can I get it not to authenticate?
    Monday, April 6, 2009 9:41 AM
  • I didn't want to make the server a domain member (What I understood needed to happen to get authentication working) and I scoured to the edge of the earth to try to make it work with no avail.  Workaround, I simply installed bmail command line mailing utility (Free) and scheduled task to run an application.

    bmail script is like this:

    bmail -s smtpserver.tld -t recipent@contsco.com -f sender@domain.com -h -a "Alert Notice Subject" -b "xyz alert has been triggered. Microsoft task alert's via email lick balls."

     

     Thanks,

    -Brian
     

    Brian J. Brandon, CCNP

    Zuit Security Research and Defense

    Http://www.Zuit.net
    • Proposed as answer by Zuit Security Tuesday, February 9, 2010 12:12 PM
    Tuesday, February 9, 2010 12:12 PM
  • Brian thank you for this alternative, I have been attempting to get the Task Scheduler to send an email to a distribution group for weeks, and the task kept failing for one reason or the other.

    Now, through bmail, the process is much simplified and if the event viewer triggers an error for what I'm watching I get the email alert. I'm not sure why the task scheduler method needs to be so complex, but I appreciate this alternative process.

    Tuesday, February 15, 2011 10:50 PM
  • (...) If the SMTP server is a non-Windows based server, then the e-mail will be sent if the server allows anonymous access.

     

    (...) 

    Tim Quan - MSFT

    Hi everybody.

    I got *veeeery* late into this subject, but unfortunately it seems to me that task scheduler always try to authenticate to the smtp server, even if it is not an MS one. See the log below and notice the bold line:

    "TCPIP"    11072    "2011-03-16 10:25:06.845"    "TCPConnection - Posting AcceptEx on 0.0.0.0:25"
    "DEBUG"    11072    "2011-03-16 10:25:06.860"    "Creating session 51"
    "SMTPD"    11072    51    "2011-03-16 10:25:06.860"    "127.0.0.1"    "SENT: 220 ******** ESMTP"
    "SMTPD"    10896    51    "2011-03-16 10:25:06.860"    "127.0.0.1"    "RECEIVED: EHLO ********"
    "SMTPD"    10896    51    "2011-03-16 10:25:06.860"    "127.0.0.1"    "SENT: 250-********[nl]250-SIZE 20480000[nl]250 AUTH LOGIN"
    "SMTPD"    10896    51    "2011-03-16 10:25:06.860"    "127.0.0.1"    "RECEIVED: AUTH LOGIN"
    "SMTPD"    10896    51    "2011-03-16 10:25:06.860"    "127.0.0.1"    "SENT: 334 VXNlcm5hbWU6"
    "DEBUG"    10896    "2011-03-16 10:25:06.876"    "Ending session 51"

    So my question is: is there a way to prevent this login try?

    Thanks in advance and forgive my poor English.

    Wednesday, March 16, 2011 3:00 PM
  • This continues to come up in multiple forums from time-to-time so I thought I would share my findings. 

    Server 2008 R2 domain - Exchange 2010 SP1 update 5.
    I was trying, for several days, to figure out exactly what was causing Task Scheduler to fail to send emails. After following a few different forum trails, and performing some trial and error testing, I've come to the following conclusion -

    Unless you make changes to the administrator account (adminSD holder object) you CANNOT run the email-sending task using the domain administrator account or have the domain administrator's email address in the 'From' field of the email message.

    That second part was the one that had me stumped. If you try to run the task using the administrator account you will get an MSExchangeTransport 1020 event in your Exchange servers' application log complaining that the domain\administrator is not authorized to use this server. If you have the domain administrators' email address in the 'From' field of the email message you just get a very generic 'Run Failure' with 'Error Value: 2147746321' in Task Scheduler and nothing on your Exchange server. Once you use a different user for both you can use Task Scheduler to send emails internally and externally till your heart's content.

    I'm currently using it to send hourly emails to my work address as a sort of po' man's Exchange check.


    • Edited by Alceryes Saturday, September 10, 2011 8:29 PM SS
    • Proposed as answer by JF101010 Tuesday, September 20, 2011 9:46 PM
    • Unproposed as answer by JF101010 Tuesday, September 20, 2011 9:47 PM
    • Proposed as answer by WaJo19 Tuesday, November 13, 2012 9:52 PM
    Saturday, September 10, 2011 7:51 PM
  • This trace gives the key.  The task scheduler always tries to authenticate.  I'd be quite interested in a way to change that behaviour, but have a work around in an Exch 2010 SP1/MS AD setting

    1. The receive connector in Exch 2010 needs to be set to offer Windows Integrated authentication
    2. The account used to run the task needs to be mail enabled
    3. The FROM address of the email being sent needs to be for that user account
    4. The user account needs appropriate rights and permissions to run the task on the machine it's running on
    5. The UPN of the user acct should match the email address.  (Haven't fully tested this one, but in the test case i used it was set that way and I've seen that requirement a lot.)
    6. The acocunt does NOT need to be an admin account in the domain or anything other than Domain User in the domain.

    But i heartily agree, if someone can find a way to turn off the Task Sceduler trying to authenticate and just use anonymous this would be a LOT easier.

     

    Tuesday, September 20, 2011 9:58 PM
  • Please add me to the list of people waiting for a fix. I have two mail servers and neither is a "Microsoft" product. I cannot get it to work either. It seems kind of silly this feature would only work with Microsoft Exchange, and very simple to make it work with thousandsd of email servers out there using industry standards.


    • Edited by Oregonbob Monday, November 14, 2011 7:25 PM
    Monday, November 14, 2011 7:24 PM
  • Best solution that worked best for me is to install SMTP on a non windows 2k3 box and in the properties of SMTP -> relay restriction select all except below. And it is working fine for me.
    Friday, December 9, 2011 7:51 AM
  • I tried to use Bmail but it does not support authentication, so I've used the SMTPMailSender (http://www.snapfiles.com/get/smtpmailsender.html) like this:

    smtpmailsender.exe -t <to_email> -f <from_email> -s "'subject" -b "message_body" -username <your_email_account_username> -password <your_email_account_passwd> -send

    The line above goes to Task Scheduler either directly from the Task Scheduler menu -> Create Basic Task ...  or from Event Viewer -> Attach Task to This Event .... . Select "Run a program" as the action for the task to perform.

    Thanks,

    Adrian


    • Proposed as answer by AdyCan Tuesday, June 12, 2012 8:06 AM
    • Edited by AdyCan Tuesday, June 12, 2012 8:12 AM
    Tuesday, June 12, 2012 8:05 AM
  • Hy AdyCan,

    I tried setting the SMTPmailsender according to your specifications. Works correctly if I run a .bat  file, but does not work if you start it from the task scheduler (same file). I tried to start .SMTPmailsender.exe from task scheduler, assigning additional parameters, but it did not work. Any suggestions?

    Thanks,

    Paulo Pereira

    Tuesday, June 12, 2012 11:29 AM
  • Hi,

    I also got the Event Viewer error 202: Action Failed error with Additional Data: Error Value: 2147746321.

    This was on a Server 2008 R2 Standard server,  trying to send an email through an Exchange 2010 cluster.

    The solution was twofold for me:

    1: Set the Task to run as the local System user

    2: Modify the Exchange Receive connector to allow Windows Integrated Authentication.

    After this, it immediately worked.I presume it would also work when using a domain account, as long as you use the correct value in the FROM: filed, as mentioned earlier in this thread.

    Monday, July 2, 2012 1:07 PM
  • AndyCan solved me, Pereira!

    You must complete the optional field with the path of folder smtpmailsender is, and works completely silent.

    Thursday, February 21, 2013 3:46 PM
  • FYI: found another cause - a bug in the send-mail function used by the task scheduler.

    If an attachment has a line feed character which is not proceeded by a carriage return you'll see the error.

    http://superuser.com/questions/877095/windows-task-scheduler-error-2147746322-sending-mail-with-attachment

    Thursday, February 12, 2015 2:34 PM
  • I have 4 identical Windows Server 2008 (SP2) systems running on the same network switch each supporting the same web application. 3 of the 4 allow sending email via an event driven scheduled task. The 4th gives me the 202 error with Error Value: 2147942402.

    All 4 app servers are using the same SMTP server, so it does not have anything to do with the SMTP server since it works for 3 of the 4. I realize the majority of the time this is a user setup issue, but in may case it seems like this truly is a bug of some sort. The servers are set up in the same way, have the same software and options installed, and they are all on the same network (physically the same switch), using the exact same task scheduler setup.

    Very frustrating.

    I've tested sending email via telnet from the app server which fails to send email via the task scheduler. Using telnet works, using task scheduler does not.

    Monday, March 16, 2015 6:37 PM
  • Solved my own problem shortly after reading back my own post.

    The SMTP server is an Exchange server. Turns out 3 of the 4 app servers were configured for bouncing SMTP requests unauthorized, but the 4th was not. Simple.

    Wednesday, April 1, 2015 5:09 PM
  • For me it was using a service account as the user to run the action to Send an Email. It kept erroring with "2147746321". Changed it to a normal user with access to the SMTP and it worked flawlessly.
    Thursday, June 4, 2015 1:53 PM
  • Strugling for more than 8 hours to get this working, maybe someone can benefit from this.

    Environment:

    Windows domain 2008R2 (functional level 2008R2)

    Exchange 2010 SP8 on server 2008R2 (upgraded 2 years ago from Exchange 2003)

    Case: try to run an email task from a 2008R2 box as a normal domain user account for security reasons.

    Problem: EventID: 202 Action Failed Run Failure Additional Data: Error Value: 2147746321

    Fix: make the user a member of the security group "Exchange Services" on the domain controller.

    I know this group is depreciated but this works. Don't know why. Please enlighten me if someone knows.....

    Note: the domain member must be member of the local group "Performance Log Users". This group is by default a member of the "User Rights Assigment" - Log on as a batch job. You can check this by running secpol.msc on the box. If this setting i grayed out, then there is a policy applying on that server.

    Note2: If you get this error while creating the task, you probably disabled cashed crendentials. You can check out by looking at the registry: HKLM\SYSTEM\CurrenControlSet\Control\Lsa

    if disableddomaincreds=1 it is ON. Set it to 0 and register the task.


    • Edited by WH277 Wednesday, August 12, 2015 11:37 AM
    Wednesday, August 12, 2015 11:25 AM