Created
May 4, 2014 06:19
-
-
Save janzikan/5b07c43ca1e9f909d2ff to your computer and use it in GitHub Desktop.
VBS: Send email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'****CONFIGURE THE FROM EMAIL ADDRESS AND PASSWORD | |
Const fromEmail = "[email protected]" | |
Const password = "password" | |
'****END OF CONFIGURATION | |
Dim emailObj, emailConfig | |
Set emailObj = CreateObject("CDO.Message") | |
emailObj.From = fromEmail | |
emailObj.To = "email_address" | |
emailObj.Subject = "Test" | |
emailObj.TextBody = "Text" | |
Set emailConfig = emailObj.Configuration | |
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" | |
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 | |
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 | |
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 | |
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true | |
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = fromEmail | |
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = password | |
emailConfig.Fields.Update | |
emailObj.Send | |
Set emailobj = nothing | |
Set emailConfig = nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment