Ejemplo n.º 1
0
        public Task Execute(string apiKey, string subject, string message, string email)
        {
            var client = new SendGridClient(apiKey);
            var msg    = new SendGridMessage()
            {
                // From = new EmailAddress("*****@*****.**", "LOVE IS..."),
                From             = new EmailAddress("*****@*****.**", "LOVE IS..."),
                Subject          = subject,
                PlainTextContent = message,
                HtmlContent      = message
            };

            msg.AddTo(new EmailAddress(email));
            // Disable click tracking.
            // See https://sendgrid.com/docs/User_Guide/Settings/tracking.html
            msg.SetClickTracking(false, false);
            return(client.SendEmailAsync(msg));
        }
Ejemplo n.º 2
0
        public async Task <Response> Execute(string apiKey, string subject, string message, string email)
        {
            var client = new SendGridClient(apiKey);
            var msg    = new SendGrid.Helpers.Mail.SendGridMessage()
            {
                From             = new EmailAddress(EmailFrom, EmailName),
                Subject          = subject,
                PlainTextContent = message,
                HtmlContent      = message,
            };

            msg.AddTo(new EmailAddress(email));

            // Disable click tracking.
            // See https://sendgrid.com/docs/User_Guide/Settings/tracking.html
            msg.SetClickTracking(false, false);

            var response = await client.SendEmailAsync(msg);

            return(response);
        }