Ejemplo 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);
        }
Ejemplo 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());
        }
Ejemplo 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);
        }
Ejemplo n.º 4
0
 public void SendAsync(EmailConfig emailConfig)
 {
     QMailerService.SendAsync(emailConfig);
 }