% '======================================================================================================================= ' Order-related outbound email: the "continue your order" link and the order-details ' confirmation sent after SubmitOrderDetails. '======================================================================================================================= Class OrderMailer_Class Public Sub SendContinuationEmail(email, token) Dim continueUrl continueUrl = Routes().AppURL & "order/continue?token=" & Server.URLEncode(token) Dim mail : Set mail = NewConfiguredMail() mail.Subject = "Continue your Purple Envelope order" mail.IsBodyHTML = True mail.Body = "
Click the link below to continue your order:
" & _ "" & _ "This link expires in " & H(GetAppSetting("OrderTokenExpirationHours")) & _ " hours and can only be used once.
" mail.AddRecipient "To", email mail.Send End Sub ' Best-effort: the order is already safely persisted by the time a caller reaches this - ' an SMTP hiccup here should not turn a successful submission into a failed one. Public Sub SendOrderDetailsEmail(order, model) On Error Resume Next Dim mail : Set mail = NewConfiguredMail() mail.Subject = "Your Purple Envelope order details - Jurisdiction " & order("JurisdictionNumber") mail.IsBodyHTML = True mail.Body = BuildOrderDetailsEmailBody(order, model) mail.AddRecipient "To", order("Email") mail.Send Err.Clear On Error GoTo 0 End Sub '------------------------------------------------------------------------------------------------------------------- ' Private helpers '------------------------------------------------------------------------------------------------------------------- Private Function NewConfiguredMail() Dim smtpPort : smtpPort = GetAppSetting("SmtpPort") If Not IsNumeric(smtpPort) Then smtpPort = 25 Dim mail : Set mail = CDOEmail() mail.SMTPServer = GetAppSetting("SmtpServer") mail.SMTPPort = CInt(smtpPort) mail.SMTPUsername = GetAppSetting("SmtpUsername") mail.SMTPPassword = GetAppSetting("SmtpPassword") mail.SMTPUseSSL = (LCase(GetAppSetting("SmtpUseSSL")) = "true") mail.From = GetAppSetting("SmtpFromAddress") Set NewConfiguredMail = mail End Function Private Function BuildOrderDetailsEmailBody(order, model) Dim html html = "" & _ "" & _
"
|