Ejemplo n.º 1
0
        public async Task SendEmailAsync(List <string> emails, string subject, string title, string body)
        {
            var msg = new SendGridMessage()
            {
                From        = new EmailAddress(SenderEmail, _senderName),
                Subject     = subject,
                HtmlContent = _builder.CreateTemplate(title, body),
            };

            msg.AddTos(emails.Select(email => new EmailAddress(email)).ToList());

            var client = new SendGridClient(_apiKey);
            await client.SendEmailAsync(msg);
        }