public TestMailerRepository() {
            mailers = new List<Mailer>();
            
            Mailer m = new Mailer(MailerType.CustomerOrderReceived, "*****@*****.**", "name", "subject", "body #STORENAME# #USERNAME# #ORDERLINK#", false);
            mailers.Add(m);

            m = new Mailer(MailerType.AdminOrderReceived, "*****@*****.**", "name", "subject", "body #STORENAME# #USERNAME# #ORDERLINK#", false);
            mailers.Add(m);

            m = new Mailer(MailerType.CustomerOrderCancelled, "*****@*****.**", "name", "subject", "body #STORENAME# #USERNAME# #ORDERLINK#", false);
            mailers.Add(m);

            m = new Mailer(MailerType.CustomerPaymentAuthFailed, "*****@*****.**", "name", "subject", "body #STORENAME# #USERNAME# #ORDERLINK#", false);
            mailers.Add(m);

            m = new Mailer(MailerType.CustomerOrderShipped, "*****@*****.**", "name", "subject", "body #STORENAME# #USERNAME# #ORDERLINK#", false);
            mailers.Add(m);

            m = new Mailer(MailerType.InventoryCheckFailed, "*****@*****.**", "name", "subject", "body #STORENAME# #USERNAME# #ORDERLINK#", false);
            mailers.Add(m);
            
            m = new Mailer(MailerType.AdminProcessingError, "*****@*****.**", "name", "subject", "body #STORENAME# #USERNAME# #ORDERLINK#", false);
            mailers.Add(m);

            m = new Mailer(MailerType.CustomerAddressValidationFailed, "*****@*****.**", "name", "subject", "body #STORENAME# #USERNAME# #ORDERLINK#", false);
            mailers.Add(m);



        }
Exemplo n.º 2
0
 public void Mailer_ShouldHave_UserName_Email_Subject_Body_HtmlFlag_Status_SendDate_SMTPResponse_Counts() {
     Mailer m = new Mailer(MailerType.CustomerOrderReceived,
         "*****@*****.**", "testuser", "test subject", "test body", false);
     Assert.AreEqual("*****@*****.**", m.ToEmailAddress);
     Assert.AreEqual("testuser", m.UserName);
     Assert.AreEqual("test subject", m.Subject);
     Assert.AreEqual("test body", m.Body);
 }
        public void Send(MailMessage message) {

            Mailer m = new Mailer();
            m.Body = message.Body;
            m.ToEmailAddress = message.To[0].Address;
            m.Subject = message.Subject;
            
            SentMail.Add(m);
        }
Exemplo n.º 4
0
        public void Send(Mailer mailer) {


            MailMessage message = new MailMessage(mailer.FromEmailAddress, mailer.ToEmailAddress, mailer.Subject, mailer.Body);
            message.IsBodyHtml = mailer.IsHtml;
            message.ReplyTo = new MailAddress(mailer.FromEmailAddress);

            SmtpClient smtp = new SmtpClient();

            //let the exceptions bubble...
            Send(message);

            //if no problem - set to success
            mailer.SMTPResponse = "Success";

            //reset the mailer status
            mailer.Status = MailerStatus.Sent;

        }
 public void Send(Mailer mailer) {
     SentMail.Add(mailer);
 }