Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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 = "";
//To address
string toAddress = "";
//Instantiate SendGrid object
var myMessage = new SendGridMessage();
myMessage.From = new MailAddress(fromAddress);
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
/// <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();
trace.Info("Bug report sent");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment