public void SendSingleWithAttachmentsTest() { string method = "_SendSingleWithAttachmentsTest"; SendMail.UseSendGrid mail = new SendMail.UseSendGrid { ApiKey = SendMailSettings.Default.SendGridApiKey }; mail.SetSender(SendMailSettings.Default.From, SendMailSettings.Default.FromName); mail.SetRecipientTo(SendMailSettings.Default.To, SendMailSettings.Default.ToName); mail.SetMailDetail(SendMailSettings.Default.Subject + method, SendMailSettings.Default.Body); List <string> attachments = new List <string> { SendMailSettings.Default.AttachmentPath_1, SendMailSettings.Default.AttachmentPath_2, SendMailSettings.Default.AttachmentPath_3 }; mail.SetAttachment(attachments); Assert.AreEqual(mail.Send(), System.Net.HttpStatusCode.Accepted); }
public void SendMultipleTest() { string method = "_SendMultipleTest"; SendMail.UseSendGrid mail = new SendMail.UseSendGrid { ApiKey = SendMailSettings.Default.SendGridApiKey }; mail.SetSender(SendMailSettings.Default.From, SendMailSettings.Default.FromName); List <SendGrid.Helpers.Mail.EmailAddress> to = new List <SendGrid.Helpers.Mail.EmailAddress>(); for (int i = 0; i < 5; i++) { to.Add(new SendGrid.Helpers.Mail.EmailAddress(SendMailSettings.Default.To, SendMailSettings.Default.ToName + "_" + i)); } mail.SetRecipientTo(to); mail.SetMailDetail(SendMailSettings.Default.Subject + method, SendMailSettings.Default.Body); Assert.AreEqual(mail.Send(), System.Net.HttpStatusCode.Accepted); }
public void SendSingleTest() { string method = "_SendSingleTest"; SendMail.UseSendGrid mail = new SendMail.UseSendGrid { ApiKey = SendMailSettings.Default.SendGridApiKey }; mail.SetSender(SendMailSettings.Default.From, SendMailSettings.Default.FromName); mail.SetRecipientTo(SendMailSettings.Default.To, SendMailSettings.Default.ToName); mail.SetMailDetail(SendMailSettings.Default.Subject + method, SendMailSettings.Default.Body); Assert.AreEqual(mail.Send(), System.Net.HttpStatusCode.Accepted); }