Knowledgebase:
Send Email Using VTL
Posted by Mohammad Rahhal, Last modified by Mohammad Rahhal on 25 June 2015 12:52 PM

'###########################################################
' Script Name: Send Email Using VTL
' Descreption:  This is a client script to send emails using VTL
' Date: June, 25nd, 2015
' User Variables:
'- EmailTo
'- EmailSubject
'- EmailBody
'- EmailFrom
'- EmailFromName
'- SMTPServer
'- SMTPLogon
'- SMTPPassword
'- SMTPSSL
'- SMTPPort
'###########################################################

Dim EmailTo
Dim EmailSubject
Dim EmailBody
Public 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 = false
SMTPPort = 25
cdoSendUsingPort = 2 'Send the message using SMTP over TCP/IP networking.
cdoBasic = 1 ' BASIC clear text authentication
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = EmailSubject
objMessage.From = """" & EmailFromName & """ <" & EmailFrom & ">"
objMessage.To = EmailTo
objMessage.TextBody = EmailBody
' Second, configure the server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = SMTPLogon

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = SMTPPassword

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort

objMessage.Configuration.Fields.Update

objMessage.Send

End Sub 

 


See Also


Back to VTL Client Script Index

(1 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

Help Desk Software by Hybrid Solutions