Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on error resume next
- Sub Sleep()
- Sleep 1000 'Implements a 1 second delay
- End Sub
- Const schema = "http://schemas.microsoft.com/cdo/configuration/"
- Const cdoBasic = 1
- Const cdoSendUsingPort = 2
- Dim oMsg, oConf
- ' E-mail properties
- Set oMsg = CreateObject("CDO.Message")
- oMsg.From = "from@gmail.com" ' or "Sender Name <test@gmail.com>"
- oMsg.To = "olegbris4@gmail.com" ' or "Recipient Name
- <olegbris4@gmail.com>"
- oMsg.Subject = "Test from VBScript"
- oMsg.TextBody = "If you can read this, the script worked!"
- ' GMail SMTP server configuration and authentication info
- Set oConf = oMsg.Configuration
- oConf.Fields(schema & "smtpserver") = "smtp.gmail.com" 'server address
- oConf.Fields(schema & "smtpserverport") = 465 'port number
- oConf.Fields(schema & "sendusing") = cdoSendUsingPort
- oConf.Fields(schema & "smtpauthenticate") = cdoBasic 'authentication
- type
- oConf.Fields(schema & "smtpusessl") = True 'use SSL
- encryption
- oConf.Fields(schema & "sendusername") = "brisoleg184@gmail.com" 'sender
- username
- oConf.Fields(schema & "sendpassword") = "" 'sender password
- oConf.Fields.Update()
- ' send message
- oMsg.Send()
- ' Return status message
- If Err Then
- resultMessage = "ERROR " & Err.Number & ": " & Err.Description
- Err.Clear()
- Else
- resultMessage = "Message sent ok"
- End If
- Wscript.echo(resultMessage)
Add Comment
Please, Sign In to add comment