The Email activity can be used to send an email to a given set of users via a specific SMTP server. This can be used when the TFS alerting emails just don’t provide the detail you need. In this example we aim to show the the basic steps that are required
to get the activity integrated into a build.
Before you can make use of any of the
TFS 2010 community build activities you have to make sure they are available for the build system and on your development PC. Instructions for this process can be found in the
ALM Rangers build guide or in the
StyleCop page of this wiki. This page assumes the Email activity is available in the developers build process workflow toolbox. Hence we are able to build the workflow shown below
Configuring the activity
Using the Email activity is very straight forward, once it is dropped onto the build process design surface only four properties have to be set (as a minimum) to send an email.
- MailFrom: a string containing an email address e.g. "build@mydomain.com"
- Subject: a string, one including the build number is a good idea e.g.
String.Format("An email from build {0}", BuildDetail.BuildNumber)
- MailTo: a string array of email addresses e.g. New string() {“developer@mydomain.com”}
- SMTP: a string containing the SMTP server URL e.g. “mysmtpserver.domain.com”
You can of course set other properties such as Body and Attachments to send more useful emails.
Remember it is probably best to pass at least the MailTo: and SMTP: values as build process arguments, as these are very likely to need to be edited for different build.
Running the activity
When you run this, if your build box is not inside your firewallthere is a a good chance you will get SMTP authentication errors. However, these should be easy to resolve given the detailed error report

Assuming the user running the TFS build service has suitable SMTP rights, the you should receive your email when the activity runs.