private void SendAuthorizationEmail(User newUser) { // Set up the message string messageBody = MessageBodyTop; string messageAuth = MessageBodyAuthCode.Replace(AuthCodeText, newUser.VerificationCode.ToString()); messageBody += messageAuth; string messageTime = MessageBodyActivateTime.Replace(ActivateTimeText, newUser.VerificationByTime.ToString("HH:mm:ss tt")); messageBody += messageTime; messageBody += MessageBodyBottom; // Set up the mail connection parameters StmpConnection connection = new StmpConnection(_smtpConfig.EmailAddress, _smtpConfig.Password); // Set up the message parameters HtmlEmailDefinition emailDefinition = new HtmlEmailDefinition { FromEmailDisplayName = _smtpConfig.Username, ToEmail = newUser.Email, ToEmailDisplayName = newUser.Name, Subject = MessageSubject, BodyHtml = messageBody }; SmtpEmailer.SendHtmlEmail(connection, emailDefinition); }
private void SendExportEmailToUser(ExportDataToEmailRequest exportRequest) { // Set up the message string messageBody = MessageBodyTop; string messageAuth = MessageBodyAuthCode.Replace(AuthCodeText, "some code"); messageBody += messageAuth; string messageTime = MessageBodyActivateTime.Replace(ActivateTimeText, "xsome time"); messageBody += messageTime; messageBody += MessageBodyBottom; // Set up the mail connection parameters StmpConnection connection = new StmpConnection(_smtpConfig.EmailAddress, _smtpConfig.Password); // Set up the message parameters HtmlEmailDefinition emailDefinition = new HtmlEmailDefinition { FromEmailDisplayName = _smtpConfig.Username, ToEmail = exportRequest.DestinationEmail, ToEmailDisplayName = "Guy we know", Subject = MessageSubject, BodyHtml = messageBody }; SmtpEmailer.SendHtmlEmail(connection, emailDefinition); }