Exemplo n.º 1
0
 public static void Send(BBS.Libraries.Emails.MailMessage email)
 {
     using (var smtp = new System.Net.Mail.SmtpClient())
     {
         smtp.Send(email.Message());
     }
 }
Exemplo n.º 2
0
        public void Emails_Can_Be_Serialized_As_Json()
        {
            var mail = new BBS.Libraries.Emails.MailMessage();

            var serializedMessage = "{\"From\":null,\"Sender\":null,\"ReplyToList\":{\"$type\":\"BBS.Libraries.Emails.EmailAddressCollection, BBS.Libraries.Emails\",\"$values\":[]},\"To\":{\"$type\":\"BBS.Libraries.Emails.EmailAddressCollection, BBS.Libraries.Emails\",\"$values\":[]},\"CC\":{\"$type\":\"BBS.Libraries.Emails.EmailAddressCollection, BBS.Libraries.Emails\",\"$values\":[]},\"Bcc\":{\"$type\":\"BBS.Libraries.Emails.EmailAddressCollection, BBS.Libraries.Emails\",\"$values\":[]},\"Priority\":0,\"DeliveryNotificationOptions\":0,\"Subject\":null,\"SubjectEncoding\":null,\"Headers\":null,\"HeadersEncoding\":null,\"Body\":null,\"BodyEncoding\":null,\"IsBodyHtml\":false,\"Attachments\":{\"$type\":\"BBS.Libraries.Emails.MailMessageAttachmentCollection, BBS.Libraries.Emails\",\"$values\":[]},\"AlternateViews\":[]}";

            var serializedResult = mail.ToJsonString <BBS.Libraries.Emails.MailMessage>();

            Assert.That(serializedResult, Is.EqualTo(serializedMessage));
        }
Exemplo n.º 3
0
        public static bool Send(BBS.Libraries.Emails.MailMessage email)
        {
            bool result = true;

            try
            {
                using (var smtp = new System.Net.Mail.SmtpClient())
                {
                    smtp.Send(email.Message());
                }
            }
            catch (Exception exception)
            {
                result = false;
            }

            return(result);
        }