Esempio n. 1
0
        // [TestMethod]
        public void Send_Email_With_Custom_Smtp_Factory()
        {
            var model = new TestModel()
            {
                FirstName    = "TestFirstName",
                LastName     = "TestLastName",
                CreationDate = DateTime.Now
            };

            var smtpClient = new MockSmtpClientFactory();

            GlobalConfiguration.Configuration.SmtpClientFactory = smtpClient;

            var messageId   = Guid.NewGuid().ToString();
            var emailConfig = QMailerService.CreateEmailConfig(messageId);

            emailConfig.SetView("test")
            .AddRecipient(new EmailAddress()
            {
                Address = "*****@*****.**"
            })
            .AddParameter("param1", "value1")
            .SetSender("*****@*****.**", "marc", "god", "code", true)
            .SetModel(model);

            QMailerService.SendAsync(emailConfig);

            Assert.AreNotEqual(0, smtpClient.CreateCount);
        }
Esempio n. 2
0
        public ActionResult Contact(string templateName)
        {
            string messageId   = Guid.NewGuid().ToString();
            var    emailConfig = QMailerService.CreateEmailConfig(messageId);

            emailConfig.SetView(templateName)
            .AddRecipient(new QMailer.EmailAddress()
            {
                Address = "*****@*****.**", SendingType = EmailSendingType.To
            });

            QMailerService.SendAsync(emailConfig);

            return(View());
        }
Esempio n. 3
0
        public void Send_Email()
        {
            var model = new TestModel()
            {
                FirstName    = "TestFirstName",
                LastName     = "TestLastName",
                CreationDate = DateTime.Now
            };

            var messageId   = Guid.NewGuid().ToString();
            var emailConfig = QMailerService.CreateEmailConfig(messageId);

            emailConfig.SetView("test")
            .AddRecipient(new EmailAddress()
            {
                Address = "*****@*****.**"
            })
            .AddParameter("param1", "value1")
            .SetSender("*****@*****.**", "marc", "god", "code", true)
            .SetModel(model);

            QMailerService.SendAsync(emailConfig);
        }
Esempio n. 4
0
 public void SendAsync(EmailConfig emailConfig)
 {
     QMailerService.SendAsync(emailConfig);
 }