// [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); }
public void Add_Attachment() { 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) .AddAttachment("filename.pdf", "application/pdf", @".\file.pdf") .SetModel(model); System.IO.File.WriteAllText(@".\base64.txt", emailConfig.Attachments[0].Content); }
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()); }
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); }
public EmailConfig CreateEmailConfig(string messageId) { var emailConfig = QMailerService.CreateEmailConfig(messageId); return(emailConfig); }