Sunday, December 7, 2008

TFS 2008 and Gmail

How to send email alerts from TFS through Gmail.

After I have set-up the Team Foundation Server I needed to set-up the email alerts, especially alerts for when new work items get assigned. We are using Google apps in the company, so I just set-up another account inside our Google domain for alerts and went to configure the TFS. For me, this turned out to be the most challenging part of the Team Foundation Server set-up.

This blog entry helped me a lot:

http://geekswithblogs.net/DavidBarrett/archive/2008/06/13/team-foundation-server-tfs-2008-and-authenticated-smtp---a.aspx


To send email alerts through Gmail you will need to install the following components:

Visual Studio Team System Web Access 2008 Power Tool

Stunnel

And you will also need to set-up an SMTP virtual server on the machine.


Setting-up TFS:

After installing the web access power tool go to

C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Services\Web.config

And set it to look like this:

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

<configuration>

   <appSettings>

    <add key="ConnectionString" value="Application Name=TeamFoundation;Persist Security Info=False;Initial Catalog=TfsIntegration;Data Source=SERVERNAME\TEAMSTUDIO;Integrated Security=SSPI"/> 

    <add key="eventingEnabled" value="true" />

    <add key="DetailedExceptions" value="true" />

    <add key="emailNotificationFromAddress" value="TFS@YourGmailDomain.com" />

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

     

  appSettings>

     <runtime>

     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

      <probing privatePath="bin\Plugins;bin\Plugins\zh-chs;bin\Plugins\zh-cht;bin\Plugins\de;bin\Plugins\es;bin\Plugins\fr;bin\Plugins\it;bin\Plugins\ja;bin\Plugins\ko"/>

    assemblyBinding>

  runtime>

   <system.web>

    

   <httpHandlers>

       <add verb="*" path="methodology.asmx" type="Microsoft.TeamFoundation.Client.MethodologyDownloadHandler" />

       <add verb="*" path="methodologyUpload.asmx" type="Microsoft.TeamFoundation.Client.MethodologyUploadHandler" />

   httpHandlers>

   system.web>

 configuration>

 

The actual SMTP configuration is found at:

C:\Program Files\Microsoft Visual Studio 2008 Team System Web Access\Web\web.config

You need to set it up to look something like this:

(the file is long, so I will only include the parts you need to edit)

     

    <emailSettings sendingEmailEnabled="true"  />

    

  <system.net>

    <mailSettings>

           <smtp deliveryMethod="network" from=" TFS@YourGmailDomain.com ">

         

       

               

              <network  host="localhost" port="25" enableSsl="false" defaultCredentials="true"/>

           smtp>

    mailSettings>

  system.net>

 

This will make TFS to connect to an SMTP server on localhost, now you need to set-up the virtual SMTP server.

Setting-up the SMTP server:

Go to ISS manager ->

Default SMTP Virtual Server -> Properties ->  Delivery -> Outbound Security

And choose “Basic authentication”

Username: TFS@ YourGmailDomain.com

Password: YourPassword

Do not enable TLS encryption


Then go to

Default SMTP Virtual Server -> Properties ->  Delivery -> Advanced

Fully-qualified domain name:

ServerName.LocalDomainName.local

Smart host:

[localhost]

 

 

Then under Default SMTP Virtual Server -> Domains add a new remote domain

“*.com”

In its properties set:

Enable “Allow incoming mail to be relayed to this domain” 

Forward all mail to smart host

[127.0.0.1]

Outbound Security

Choose “Basic authentication”

Username: TFS@ YourGmailDomain.com

Password: YourPassword

Do not enable TLS encryption

As you have noticed the SMTP server is still set to localhost, this is where Stunnel comes in to connect you to the Gmail server.

Set-up Stunnel

You need to set-up Stunnel as a windows service (described in http://www.stunnel.org/faq/run.html#ToC7)

The stunnel.conf file should look something like this:

; Sample stunnel configuration file by Michal Trojnara 2002-2006

; Some options used here may not be adequate for your particular configuration

 

; Certificate/key is needed in server mode and optional in client mode

; The default certificate is provided only for testing and should not

; be used in a production environment

;cert = stunnel.pem

;key = stunnel.pem

 

; Some performance tunings

socket = l:TCP_NODELAY=1

socket = r:TCP_NODELAY=1

 

; Workaround for Eudora bug

;options = DONT_INSERT_EMPTY_FRAGMENTS

 

; Authentication stuff

;verify = 2

; Don't forget to c_rehash CApath

;CApath = certs

; It's often easier to use CAfile

;CAfile = certs.pem

; Don't forget to c_rehash CRLpath

;CRLpath = crls

; Alternatively you can use CRLfile

;CRLfile = crls.pem

 

; Some debugging stuff useful for troubleshooting

;debug = 7

;output = stunnel.log

 

; Use it for client mode

;client = yes

 

; Service-level configuration

;service = Stunnel-Client

 

;[pop3s]

;accept  = 995

;connect = 110

 

;[imaps]

;accept  = 993

;connect = 143

 

client = yes

debug = debug

[pop3s]

accept = 127.0.0.1:1109

connect = pop.gmail.com:995

 

[smtps]

accept = 127.0.0.1:40

connect = smtp.gmail.com:465

;

;[ssmtp]

;protocol=smtp

;accept  = localhost:30

;connect = smtp.gmail.com:25

 

;[https]

;accept  = 443

;connect = 80

;TIMEOUTclose = 0

 

; vim:ft=dosini

 

I did this a couple of months ago, so I might have left out something, if you find that something does not work, please mention it in the comments. This set-up has been working without any glitches scince I have set it up, but I was really disappointed with the fact that it is impossible to connect the TFS directly to a secured SMTP server, and I could not event directly forward mail to the Gmail servers from the virtual SMTP server.

 

 

16 comments:

Anonymous said...

This isn't working for me.. I've set it up as outlined above.. as soon as a change is made in TFS, I see an item pop up in the Current Sessions in Default SMTP Virtual Servers that goes on for about 70secs or so and then dies but no email... any ideas?

Dead Smile said...

I will take a look at it this afternoon and get back to you.

Anonymous said...

So turns out we have a non-SSL based smtp server from an ISP that we can use so I'm using that now using the suggestion at http://geekswithblogs.net/thibbard/archive/2006/12/13/UsingAuthenticatedSMTPServerForTFSEmailAlerts.aspx

Thanks though.

Anonymous said...

what is 127.0.0.1
My Setup is Windows Server 2008 TeamFoundation Server 2008 SP1.
when i enter 127.0.0.1 i get an error message "The domain name is not valid" i used localhost instead of this IP, is there any problem because of this.
i observed all the mails are going to badmail folder. what may be the problem

Andres Pompiglio said...

In my case it was no necesary to install Stunnel.

I've Made the following configuration:
1)IIS SMTP Server:
*Access-->Authentication -->anonymous acces
*Relay Restrictions-->All except list below
*Delivery-->Outbound Security-->Basic Authentication--> youruser@gmail.com
and password TLS Encryption
*Outbound connections-->TCP Port 25
*Advanced-->Fully Quallified Name: smtp.MACHINENAME.DOMAIN
*Advanced-->Smart Host: smtp.gmail.com

2)..\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Web.Config
*No Email Settings configurations here

3)..\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Services\Web.Config

add key="enableEmails" value="True"

add key="emailNotificationFromAddress" value="yourUser@gmail.com"

add key="smtpServer" value="localhost"

Anonymous said...

The information here is great. I will invite my friends here.

Thanks

Anonymous said...

stockport coordinate nangelil secondary diligence mitochondria vaccine nwwashington qkwez avoided landlord
servimundos melifermuly

Anonymous said...

gear werums eruptions failing implants become mainland protons vivas digitisation unbelievable
servimundos melifermuly

Anonymous said...

[u][b]Xrumer[/b][/u]

[b]Xrumer SEO Professionals

As Xrumer experts, we secure been using [url=http://www.xrumer-seo.com]Xrumer[/url] fitted a wish immediately for the time being and recollect how to harness the titanic power of Xrumer and go off it into a Spondulix machine.

We also yield the cheapest prices on the market. Diverse competitors devise charge 2x or square 3x and a destiny of the continuously 5x what we pervade you. But we believe in providing prominent accommodation at a tearful affordable rate. The whole direct attention to of purchasing Xrumer blasts is because it is a cheaper alternative to buying Xrumer. So we train to abide by that contemplating in recollection and provide you with the cheapest rate possible.

Not just do we be suffering with the unexcelled prices but our turnaround heyday payment your Xrumer posting is super fast. We will take your posting done to come you distinguish it.

We also outfit you with a full log of affluent posts on manifold forums. So that you can see over the extent of yourself the power of Xrumer and how we have harnessed it to gain your site.[/b]


[b]Search Engine Optimization

Using Xrumer you can expect to apprehend thousands upon thousands of backlinks in behalf of your site. Tons of the forums that your Location you will be posted on get exalted PageRank. Having your association on these sites can deep down expropriate found up some cover grade recoil from links and really aid your Alexa Rating and Google PageRank rating via the roof.

This is making your instal more and more popular. And with this increase in popularity as familiarly as PageRank you can think to appreciate your place really filthy expensive in those Search Motor Results.
Transport

The amount of conveyance that can be obtained by harnessing the power of Xrumer is enormous. You are publishing your plat to tens of thousands of forums. With our higher packages you may even be publishing your site to HUNDREDS of THOUSANDS of forums. Visualize 1 brief on a all the rage forum last will and testament usually rig out 1000 or so views, with communicate 100 of those people visiting your site. Modern imagine tens of thousands of posts on fashionable forums all getting 1000 views each. Your traffic longing associate sometimes non-standard due to the roof.

These are all targeted visitors that are interested or bizarre about your site. Envision how many sales or leads you can execute with this titanic figure up of targeted visitors. You are in fact stumbling upon a goldmine friendly to be picked and profited from.

Reminisce over, Above is Money.
[/b]

GET YOUR CHEAP BLAST TODAY:


http://www.xrumer-seo.com

Anonymous said...

[B]NZBsRus.com[/B]
Lose Slow Downloads With NZB Files You Can Hastily Find High Quality Movies, Console Games, MP3 Albums, Applications & Download Them @ Flying Rates

[URL=http://www.nzbsrus.com][B]NZB[/B][/URL]

Anonymous said...

[B]NZBsRus.com[/B]
Forget Sluggish Downloads With NZB Files You Can Quickly Find HD Movies, Games, MP3 Singles, Applications & Download Them @ Dashing Speeds

[URL=http://www.nzbsrus.com][B]NZB Search[/B][/URL]

Anonymous said...

Licence to pass the subhuman with two backs casinos? inquire into this advanced [url=http://www.realcazinoz.com]casino[/url] refer to and mortify up online casino games like slots, blackjack, roulette, baccarat and more at www.realcazinoz.com .
you can also confirmation our untrained [url=http://freecasinogames2010.webs.com]casino[/url] check at http://freecasinogames2010.webs.com and pay destroy in high-minded folding shin-plasters !
another whodunit [url=http://www.ttittancasino.com]casino spiele[/url] pattern is www.ttittancasino.com , because german gamblers, heap up freed online casino bonus.

Anonymous said...

Hi,

When ever I surf on web I never forget to visit this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]blaivas.blogspot.com really contains lot of useful information. Do you pay attention towards your health?. Are you really serious about your weight?. Recent Scientific Research presents that about 90% of all USA adults are either chubby or weighty[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] So if you're one of these citizens, you're not alone. Infact many among us need to lose 10 to 20 lbs once in a while to get sexy and perfect six pack abs. Now next question is how you can achive quick weight loss? You can easily lose with with little effort. Some improvement in of daily activity can help us in losing weight quickly.

About me: I am author of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also health trainer who can help you lose weight quickly. If you do not want to go under hard training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for effortless weight loss.

Anonymous said...

Logical question

Anonymous said...

It is visible, not destiny.

Anonymous said...

I apologise, I can help nothing, but it is assured, that to you will help to find the correct decision. Do not despair.