Advertisement
Guest User

Untitled

a guest
Feb 5th, 2018
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function sendRegistrationEmail(FormData)
  2.  
  3.     Set cdoMessage = CreateObject("CDO.Message")
  4.  
  5.     cdoMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  6.     cdoMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = Application("MailServerHostName")
  7.     cdoMessage.Configuration.Fields.Update
  8.  
  9.     mailBody =  "Thanks for subscribing!" & VbCrLf & VbCrLf &_
  10.                 "By subscribing to Lennox Innovations and our Get Connected e-newsletter, you'll be among the first to learn about the latest innovations in commercial comfort. You'll also get a wide range of ideas for improving your efficiency and protecting your bottom line." & VbCrLf & VbCrLF &_
  11.                 "Remember to add lennox@lennox.com to your address book to ensure delivery to your inbox." & vbCrLf & vbCrLf &_
  12.                 "Lennoxcommercial.com." & vbCrLf & vbCrLf &_
  13.                 "If you do not wish to receive further e-mails from Lennox, you can opt-out at any time. We will promptly remove your name from the mailing list." & vbCrLf & vbCrLf
  14.  
  15.     mailRecipients = """" & FormData("userFirstName") & " " & FormData("userLastName") & """ <" & FormData("userEmail") & ">"
  16.     If NOT Application("IsLive") Then
  17.         mailRecipients = mailRecipients &   ", ""Nick Wunderlin"" <nwunderlin@powercreative.com>"
  18.     End If
  19.  
  20.     With cdoMessage
  21.         .From     = "Joey.Gennari@Lennoxintl.com"
  22.         .To       = mailRecipients
  23.         .Subject = "Welcome from Lennox Commercial"
  24.         .TextBody = mailBody
  25.     End With
  26.  
  27.     On Error Resume Next
  28.     cdoMessage.Send
  29.     If Err.Number = 0 then
  30.         Success = TRUE
  31.     Else
  32.         errorNumber = Err.Number
  33.         cdoerrorMessage = Err.description
  34.         Success = TRUE
  35.         ' let's set this to ALWAYS TRUE -
  36.        ' even if we don't get to send the email due to error
  37.        ' we can still make the subscription process suceed to the user
  38.    End If
  39.  
  40.     Set cdoMessage = Nothing
  41.     Set cdoConfig = Nothing
  42.  
  43. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement