AccidentalFish.ApplicationSupport.Email.SendGrid.SendGridEmailProvider.SendAsync C# (CSharp) Метод

SendAsync() публичный Метод

public SendAsync ( IEnumerable to, IEnumerable cc, string @from, string title, string htmlBody, string textBody ) : Task
to IEnumerable
cc IEnumerable
@from string
title string
htmlBody string
textBody string
Результат Task
        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;
        }
    }