SMTP Server timeout on Alerts

Ok.. in trying to get alerts working I have tried to troubleshoot why the TFS is not communicating with the smtp server properly. It continues to timeout.

I have done the following to test.

 

Ran the following code from the TFS using the TFSSERVICE account as the from address with no problems both with UseDefaultCredentials as true and false and works just fine.

http://blogs.msdn.com/psheill/archive/2005/11/22/495863.aspx

Have also verified this through manually telneting to the SMTP server port 25 and manually entering the from as TFSSERVICE account.

Have followed this thread as well...

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=146583&SiteID=1

My trace is as follows:

2132] [CS] [Info, PID 2132, TID 4820, 16:57:16.362] Activating a new thread to send events. < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

[2132] [CS] [Info, PID 2132, TID 3144, 16:57:16.362] Entering Send loop

[2132] [CS] [Verbose, PID 2132, TID 3144, 16:57:16.362] Sending e-mail.

[2132] [CS] [Info, PID 2132, TID 3144, 16:57:16.362] Creating body for e-mail.

[2132] [CS] [Error, PID 2132, TID 3144, 16:58:56.377] { 

[2132] 

[2132] [CS] [Error, PID 2132, TID 3144, 16:58:56.377] Exception:  {

[2132] Exception Message: The operation has timed out. (type SmtpException)

[2132] 

[2132] Exception Stack Trace:    at System.Net.Mail.SmtpClient.Send(MailMessage message)

[2132]    at Microsoft.TeamFoundation.Server.WebServiceNotification.SendOneEmail(Boolean plaintext, String to)

[2132]    at Microsoft.TeamFoundation.Server.WebServiceNotification.SendEmail(Boolean plaintext)

[2132]    at Microsoft.TeamFoundation.Server.WebServiceNotification.Send(Boolean synchronous, EventHandler handler)

[2132] 

[2132]  }

[2132] [CS] [Error, PID 2132, TID 3144, 16:58:56.377] }

[2132] [CS] [Info, PID 2132, TID 3144, 16:58:56.377] Exiting Send loop

 

 




Answer this question

SMTP Server timeout on Alerts

  • Anton Eagle

    I'll see if I can get to the SMTP server logs... maybe there will be some info in there.

     



  • gknierim

    That's strange.  What kind of mail server is it trying to use (e.g. Exchange)   Is the server name specified in smtpServer exactly the same as what you used in the test program   We've seen issues when, for example, "localhost" is used instead of the actual machine name.

     


  • Razbir

    Yes... I know it is strange. I don't really understand.

    It's driving me crazy. :-)

     

    1) it is exchange

    2) I have confirmed the server name in the program as well as in the web.config file match.

    3) Have also confirmed the FromAddress is the same in the test program as well as the web.config file.

     

    The test program (domains changed to protect the innocent):

    string Host = "nwexchange01";

    string FromAddress = "tfsservice@internaldomain.net";

    string ToAddress = "myemail@somewhere.com";

     

    And from the config file:

        <add key="emailNotificationFromAddress" value="tfsservice@internaldomain.net" />< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

        <add key="smtpServer" value="nwexchange01" />

     

    One works the other... as you see hits a timeout.

     

     



  • Dreyes67

    Michael,
    I seem to have approximately the same problem with timeouts on project alerts. Was the needed permissions Local Activate and Launch, Remote Activate and Launch or both Local+Remote
    Regards,
    Thomas L

  • MikeAtOpco

     

    The Exchange logs could help a lot.  There are potentially a couple minor differences between the test program and TFS.  You might try changing them in the test program to the following: 

    1) mm.IsBodyHtml = true

    Then set the mm.Body to "<html><head><title>Test</title></head><body>Test 1</body></html>"

    2) mm.ReplyTo = new MailAddress(<email address of person performing the action, e.g. Checkin>).

    -Pete

     


  • Zeeshan Ali

    Sadly that worked as well....

    BUT

     

    And you will hate to hear this but....

     

     I rebooted the TFS server and all my alerts came pouring in.

     

     



  • David Eliason

    Ok... It's all now working. I found the issue to be related to the netman dcom component. It needed launch and activate permissions for 'Network Services'.

     

    Why it would work at boot time and then no other time I will leave to others to figure out but it now is working with those permissions added for 'Network Services'.

     

    It still leaves me with some questions... but... My Alerts now work.



  • Xeron.seron

    Correction....  It didn't work. During reboot all my alerts came in but now that it is running same story. I think there is an issue on our side.

     

    Thanks!

     



  • Laxmikant D.

     

    That's very strange.  At restart, Tfs retries the notifications that failed previously.  It is the same code doing the retry as the code that tried to send it initially.  So it's a real mystery as to why it failed initially, then succeeded but now fails again. 

     


  • SMTP Server timeout on Alerts