none
SMTP-Port for Email Alerts in TFS2010

    Question

  • Hi,

    I would like to know how you can setup your email alerts with a custom SMTP-port. I've seen a solution for TFS2008 where the web.config was edited in the Web Services-directory (C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Services). I've tried to add the port here under the system.net section:

          <mailSettings>
             <smtp deliveryMethod="Network">
               <network port="34"/>
             </smtp>
          </mailSettings>

    It doesn't really change anything. I also wonder where the settings that have been set via the Team Foundation Administration Console remain. They don't appear in this file, so I truly question my own actions.

    Any suggestions would be helpful.

    Tuesday, June 29, 2010 7:50 AM

Answers

  • Hi Pieter,

    The TFSJobAgent is called Visual Studio Team Foundation Background Job Agent in Services. Please make sure that this service is started.

    The Whole configuration file is like

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <!--
            Following setting is required for Active Directory sync. Refer http://support.microsoft.com/kb/833789.
      -->
      <configSections>
        <section name="system.directoryservices" type="System.DirectoryServices.SearchWaitHandler, System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </configSections>
      <system.directoryservices>
        <DirectorySearcher waitForPagedSearchData="true" />
      </system.directoryservices>

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <probing privatePath="Plugins"/>
        </assemblyBinding>

        <!-- Use nonConcurrent garbage collection -->
        <gcConcurrent enabled="false" />
      </runtime>

      <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0"/>
      </startup>
      <system.net>
        <mailSettings>
          <smtp >
            <network host="MySmtpServer" port="26" />
          </smtp>
        </mailSettings>
      </system.net>
      <system.diagnostics>
        <trace autoflush="false" indentsize="4">
          <!--To enable tracing to file, simply uncomment listeners section and set trace switch(es) below.
              Directory specified for TextWriterTraceListener output must exist, and job agent service account must have write permissions. -->
          <!--<listeners>
            <add name="myListener"
              type="System.Diagnostics.TextWriterTraceListener"
              initializeData="C:\Replace_Me_With_A_Directory_The_Service_Account_Can_Write_To\jobagent.log" />
            <remove name="Default" />
          </listeners>-->
        </trace>
        <switches>
          <!--  Trace Switches
                Each of the trace switches should be set to a value between 0 and 4, inclusive.
                  0: No trace output
                  1-4: Increasing levels of trace output; see Systems.Diagnostics.TraceLevel-->
          <add name="API" value="0" />
          <add name="Authentication" value="0" />
          <add name="Authorization" value="0" />
          <add name="Database" value="0" />
          <add name="General" value="0" />
          <add name="traceLevel" value="0" />
        </switches>
       </system.diagnostics>
    </configuration>


    Best regards,
    Ruiz

    Thursday, July 01, 2010 9:00 AM

All replies

  • Hi Pieter,

    Have you Eabled the SMTP in the Team Foundation Administration Console? In the following link, there is screenshot which you can refer to: 

    http://ravendra.wordpress.com/configuring-email-alert-settings-in-tfs-2010/

    Hope it helps! If you have any concern, please feel free to let me know!

    Best Regards,

    Cathy Kong

    Wednesday, June 30, 2010 5:09 AM
  • Hi Cathy,

    I have done this many times already. First there was a security issue with our SMTP-server. This was solved. I can use the SMTP-server by using telnet on the TFS-server. It is, however, set with a custom SMTP-port (not 25, which is standard). The web.config in the link you gave me are settings for TFS2008 and not TFS2010. It should work in a similar way to add the custom SMTP-port there, but somehow it hasn't worked for me. I get the error below, which clearly shows that its trying to send via port 25, which has restricted access (security reasons). I looked in IIS and saw that you can also set the SMTP-port and credentials there. If you see this post http://msdn.microsoft.com/en-us/library/ms400808(VS.80).aspx you'll see in the NOTE that it specifically asks you not to do this, because it adds an attribute to the configuration file, which apparently interferes with normal functioning. After having done this I removed the addition again from the configuration file. Somehow, it still seems to "interfere" or at least malfunction. All I know at this moment is that I keep getting the same error below from TFS Services in the Event Viewer, which means it still hasn't set the port accordingly. I can't quite understand why Microsoft hasn't added more help or functionality in this direction as it seems to be something that can happen quite easily when configuring TFS within your network. Maybe its our network-configuration that needs to change. I could set up another SMTP-server specifically for this server, but this is not recommended for security reasons and performance within the network I have been told. Some more help would be much appreciated. 

    TF53010: The following error has occurred in a Team Foundation component or extension:
    Date (UTC): 29-6-2010 15:24:24
    Machine: TFS1
    Application Domain: TfsJobAgent.exe
    Assembly: Microsoft.TeamFoundation.Framework.Server, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
    Service Host:
    Process Details:
      Process Name: TFSJobAgent
      Process Id: 2592
      Thread Id: 6564
      Account name: NT AUTHORITY\NETWORK SERVICE

    Detailed Message: TF271001: An error occurred while attempting to send an e-mail notification to the following address: [myemail@server.com]. Further e-mail notification errors that occur within the next five minutes might not be logged. Verify that the e-mail notification settings are correct in the Team Foundation Administration Console.
    Exception Message: Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender (type SmtpException)

     

    Wednesday, June 30, 2010 8:03 AM
  • Exception Message: Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender (type SmtpException)

    Maybe this message is from SMTP server.

    In my opinion, first of all Create simple test application that using SmtpClient assemly. And excute in TFS server.

    Have a good day~~

    Wednesday, June 30, 2010 8:13 AM
  • I have tested the SMTP-server using a custom port (not 25) with telnet and this works. We have setup the SMTP-server specifically in this way for TFS, because the standard port uses specific security details. That's why this message probably is generated because it still tries to send it via the 25-port, which I want to change to a custom port, as I have been mentioning.

     

    Wednesday, June 30, 2010 8:23 AM
  • Hi Pieter,

    Please add the following script in  drver:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\TFSJobAgent\TfsJobAgent.exe.config

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>

    <system.net>
      <mailSettings>
        <smtp >
          <network host="smtpserver" port="26" >
        </smtp>
      </mailSettings>
    </system.net>

    </configuration>

    For more information about this, please refer to Ruiz's blog:

    http://www.cnblogs.com/Ruiz/archive/2010/07/01/1769119.html

    Hope it helps! If you have any concern, please feel free to let me know!

    Best Regards,

    Cathy Kong

    Thursday, July 01, 2010 6:35 AM
  • Hi Cathy,

    I keep getting this message from the TFSJobagent service:

    Service cannot be started. The service process could not connect to the service controller

    It doesn't even want to start this service. I have added the configuration to the TfsJobAgent.exe.config. I have even restarted the complete TFS-server, but the TFSJobagent doesn't start. I can't find the service in the Services (via Administrative Tools) as well. I can find it in the Task Manager under Services. I can't start it from there, it says, "Access is denied". I figured this service should start automatically on startup, but it doesn't. I have changed the security-permissions for the folder under which this service is running but I also can't start it from there, it says I need to use some utility to add it to the Services. After restarting I also get another message, "The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail." In the application log you get the message that you see in Italic above. I've had a look quickly at the function of TFSJobagent, but I'm questioning whether maybe some configuration has gone wrong for this service. If you can find some info on this, or how this needs to be setup, this would be much appreciated.

     

     

     

    Thursday, July 01, 2010 8:46 AM
  • Hi Pieter,

    The TFSJobAgent is called Visual Studio Team Foundation Background Job Agent in Services. Please make sure that this service is started.

    The Whole configuration file is like

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <!--
            Following setting is required for Active Directory sync. Refer http://support.microsoft.com/kb/833789.
      -->
      <configSections>
        <section name="system.directoryservices" type="System.DirectoryServices.SearchWaitHandler, System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </configSections>
      <system.directoryservices>
        <DirectorySearcher waitForPagedSearchData="true" />
      </system.directoryservices>

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <probing privatePath="Plugins"/>
        </assemblyBinding>

        <!-- Use nonConcurrent garbage collection -->
        <gcConcurrent enabled="false" />
      </runtime>

      <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0"/>
      </startup>
      <system.net>
        <mailSettings>
          <smtp >
            <network host="MySmtpServer" port="26" />
          </smtp>
        </mailSettings>
      </system.net>
      <system.diagnostics>
        <trace autoflush="false" indentsize="4">
          <!--To enable tracing to file, simply uncomment listeners section and set trace switch(es) below.
              Directory specified for TextWriterTraceListener output must exist, and job agent service account must have write permissions. -->
          <!--<listeners>
            <add name="myListener"
              type="System.Diagnostics.TextWriterTraceListener"
              initializeData="C:\Replace_Me_With_A_Directory_The_Service_Account_Can_Write_To\jobagent.log" />
            <remove name="Default" />
          </listeners>-->
        </trace>
        <switches>
          <!--  Trace Switches
                Each of the trace switches should be set to a value between 0 and 4, inclusive.
                  0: No trace output
                  1-4: Increasing levels of trace output; see Systems.Diagnostics.TraceLevel-->
          <add name="API" value="0" />
          <add name="Authentication" value="0" />
          <add name="Authorization" value="0" />
          <add name="Database" value="0" />
          <add name="General" value="0" />
          <add name="traceLevel" value="0" />
        </switches>
       </system.diagnostics>
    </configuration>


    Best regards,
    Ruiz

    Thursday, July 01, 2010 9:00 AM
  • Hi Ruiz,

    IT WORKS!!! Hallelujah! I added it to the configuration-file. I started the TFSJobagent and then I got mail straight away! I couldn't find the service in the listing but since you mentioned the name I had another look and then I saw it and started it.

    Thank you very much!!!

    Kind regards,

    Pieter

    Thursday, July 01, 2010 9:13 AM
  • And the service (Visual Studio Team Foundation Background Job Agent) should be run with the account the same as the mail sender.

    Monday, December 06, 2010 11:04 AM