‘###########################################################
‘ Script Name:Send EmailUsingVTL
‘ Descreption: This is a client script to send emails using VTL
‘ Date: June, 25nd, 2015
‘UserVariables:
‘- EmailTo
‘-EmailSubject
‘-EmailBody
‘-EmailFrom
‘-EmailFromName
‘-SMTPServer
‘-SMTPLogon
‘-SMTPPassword
‘-SMTPSSL
‘-SMTPPort
‘###########################################################
Dim EmailToDim EmailSubjectDim EmailBodyPublic Sub main()EmailTo = "XXXXX@XXX.com"EmailSubject = "Test Email"EmailBody = "This is a test email"EmailFrom = "XXXXXX@XXXXX.com" EmailFromName = "VTL Email"SMTPServer = "XXX.XXX.com"SMTPLogon = "XXXXXX@XXXXX.com"SMTPPassword = "XXXXXX"SMTPSSL = falseSMTPPort = 25cdoSendUsingPort = 2 'Send the message using SMTP over TCP/IP networking.cdoBasic = 1 ' BASIC clear text authenticationSet objMessage = CreateObject("CDO.Message")objMessage.Subject = EmailSubjectobjMessage.From = """" & EmailFromName & """ <" & EmailFrom & ">"objMessage.To = EmailToobjMessage.TextBody = EmailBody' Second, configure the serverobjMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServerobjMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasicobjMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = SMTPLogonobjMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = SMTPPasswordobjMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPortobjMessage.Configuration.Fields.UpdateobjMessage.SendEnd Sub
See Also