AccidentalFish.ApplicationSupport.Email.Amazon.AmazonSimpleEmailProvider.SendAsync C# (CSharp) Method

SendAsync() public method

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
return Task
        public Task<string> SendAsync(IEnumerable<string> to, IEnumerable<string> cc, string from, string title, string htmlBody, string textBody)
        {
            AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(_accessKey, _secretKey);
            Destination destination = new Destination();
            destination.ToAddresses = to.ToList();
            Content subject = new Content(title);
            Body bodyContent = new Body()
            {
                Html = htmlBody == null ? null : new Content(htmlBody),
                Text = textBody == null ? null : new Content(textBody)
            };
            Message message = new Message(subject, bodyContent);
            SendEmailRequest request = new SendEmailRequest
            {
                ReplyToAddresses = new List<string>() {@from},
                Destination = destination,
                Message = message
            };
            SendEmailResponse response = client.SendEmail(request);
            return Task.FromResult(response.MessageId);
        }
    }