public static MailMessage GetContactUsEmail(SendEmailConfiguration emailConfiguration, string modelUserName, string modelTelephone, string modelEmail, string modelMessage) { //// var templatePath = ConfigurationManager.AppSettings["WelcomeTemplate"]; const string templatePath = "C:\\Raj\\TESTING\\Templates\\EMail\\ContactUsEmailTemplate.cshtml"; string body = EMailTemplateResolver.GetMessageBody( templatePath, new { Fullname = modelUserName, Telephone = modelTelephone, UserEmail = modelEmail, Message = modelMessage }); //// Dynamic object can be created and passed in the n'Parameters as the model object return new MailMessage( emailConfiguration.SenderAddress, emailConfiguration.ToAddress, emailConfiguration.Subject, body); }
private void SendContactUsEmail(EnquiryContactUsViewModel viewModel) { var emailConfiguration = new SendEmailConfiguration { ToAddress = "*****@*****.**", SenderAddress = "*****@*****.**", Subject = "Thank you for your enquiry" }; MailMessage email = EMailMessageFactory.GetContactUsEmail(emailConfiguration, viewModel.FullName, viewModel.Telephone, viewModel.EMail, viewModel.Message); EMailClient.SendEMail(email, true); }
public static MailMessage GetResetUserPasswordEmail(SendEmailConfiguration emailConfiguration) { string body = string.Empty; return new MailMessage( emailConfiguration.SenderAddress, emailConfiguration.ToAddress, emailConfiguration.Subject, body); }