public async Task<string> SendAsync(IEnumerable<string> to, IEnumerable<string> cc, string @from, string title, string htmlBody, string textBody)
{
SendGridMessage message = new SendGridMessage();
message.From = new MailAddress(@from);
if (to != null && to.Any())
{
message.AddTo(to);
}
if (cc != null && cc.Any())
{
message.AddTo(cc);
}
if (htmlBody != null)
message.Html = htmlBody;
if (textBody != null)
message.Text = textBody;
message.Subject = title;
NetworkCredential credentials = new NetworkCredential(_sendgridUsername, _sendgridPassword);
Web transportWeb = new Web(credentials);
await transportWeb.DeliverAsync(message);
return null;
}
}