Question

I have recently built a TFS plugin PoC that sends email notifications based on certain criteria. For the moment I am sending email by using a gmail account with hard-coded smtp settings. Although this works it obviously isn't acceptable for deployment, and it seems there should be a better way to do this.

I'm wondering if there is a way to leverage TFS to send the email for me, rather than use my own custom email class?

Alternatively I'm wondering if it's possible to for my plugin, which is just a .dll, to use a *.config file to read the smtp settings?

Was it helpful?

Solution 3

Ultimately what worked best for me was that I was able to put the smtp settings in the web.config located here:

C:\Program Files\Microsoft Team Foundation Server 11.0\Application Tier\Web Services\web.config

Then after adding a reference to System.Configuration I was able to read the settings like this:

string smtpServer = ConfigurationManager.AppSettings["SmtpServer"];

OTHER TIPS

TFS 2013 has built-in functionality for sending email notifications, either to yourself or to the team: MSDN guide for setting alerts in TFS

According to the linked article, you need to:

  1. Configure an SMTP server to cooperate with your TFS server, if you haven't already
  2. Open the alerts management page:Alert Drop
  3. If you need to create an alert for the entire team (not just yourself), go to the "Advanced management" page:enter image description here
  4. From here, you can create an alert for new or changed items matching any conditions that you can specify as a work-item query.

i did this in my plugin hosted on codeplex: http://tfswiwatcher.codeplex.com/

Have a look at the code for the TFS 2013 branch. This code is using server api to read the smtp settings from tfs and is using that settings to send mails.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top