Last active
April 20, 2016 04:43
-
-
Save namitts82/5a2561358622422143cea9170c06076d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace VSOBugReporter | |
{ | |
public class Functions | |
{ | |
/// <summary> | |
/// Sends an email using sendgrid | |
/// </summary> | |
/// <param name="message">message body</param> | |
private void SendMail(string message) | |
{ | |
//From address | |
string fromAddress = "bugreporter@azurebootcamp.com"; | |
//To address | |
string toAddress = "destination@hotmail.com"; | |
//Instantiate SendGrid object | |
var myMessage = new SendGridMessage(); | |
myMessage.From = new MailAddress(fromAddress); | |
myMessage.AddTo(toAddress); | |
myMessage.Subject = "Visual Studio Bug Report " + DateTime.Now.ToShortDateString(); | |
myMessage.Html = message; | |
//Your SendGrid API key here | |
var apiKey = "**** Your API Key here **** "; | |
var transportWeb = new Web(apiKey); | |
//Post Email | |
transportWeb.DeliverAsync(myMessage); | |
} | |
/// <summary> | |
/// Report Bug function triggered by VSO Web Hook | |
/// </summary> | |
/// <param name="body">JSON body</param> | |
/// <param name="trace">Trace object</param> | |
public static void ReportBug([WebHookTrigger] string body, TraceWriter trace) | |
{ | |
trace.Info("Sending Bug report"); | |
WeatherReport weatherReport = new WeatherReport(); | |
sendmail(body); | |
trace.Info("Bug report sent"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment