How to send transactional e-mail messages from a ASP.NET C# web application using Twilio SendGrid API
You can send the mail by SDK of SendGrid.
var apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY"); var client = new SendGridClient(apiKey); var from = new EmailAddress("test@example.com", "Example User"); var subject = "Sending with Twilio SendGrid is Fun"; var to = new EmailAddress("test@example.com", "Example User"); var plainTextContent = "and easy to do anywhere, even with C#"; var htmlContent = "<strong>and easy to do anywhere, even with C#</strong>"; var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent); var response = await client.SendEmailAsync(msg);
You can get the full information from here: https://github.com/sendgrid/sendgrid-csharp#quick-start