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?
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:
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.
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"];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.