Ejemplo n.º 1
0
        public async Task <SentStatus> SendTransactionalEmail(EmailParcel parcel)
        {
            if (parcel.Recipients == null || parcel.Recipients.Count <= 0)
            {
                return(SentStatus.No_Recipients);
            }

            var client = new SendGridClient(API_KEY);

            var recipient = parcel.Recipients[0];

            var from = new EmailAddress(parcel.FromEmail, parcel.FromName);
            var to   = new EmailAddress(recipient.ToEmail, recipient.ToName);

            var msg = MailHelper.CreateSingleEmail(from, to, parcel.Subject, parcel.PlainTextContent, parcel.HTMLContent);

            var result = await client.SendEmailAsync(msg);

            if (result.StatusCode == System.Net.HttpStatusCode.OK)
            {
                return(SentStatus.Success);
            }
            else
            {
                return(SentStatus.Unknown_Failure);
            }
        }
Ejemplo n.º 2
0
 public Task <SentStatus> SendMarketingEmail(EmailParcel parcel)
 {
     throw new NotImplementedException();
 }