Guest User

Untitled

a guest
Nov 15th, 2017
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. on error resume next
  2. Sub Sleep()
  3. Sleep 1000 'Implements a 1 second delay
  4. End Sub
  5.  
  6. Const schema = "http://schemas.microsoft.com/cdo/configuration/"
  7. Const cdoBasic = 1
  8. Const cdoSendUsingPort = 2
  9. Dim oMsg, oConf
  10.  
  11. ' E-mail properties
  12. Set oMsg = CreateObject("CDO.Message")
  13. oMsg.From = "from@gmail.com" ' or "Sender Name <test@gmail.com>"
  14. oMsg.To = "olegbris4@gmail.com" ' or "Recipient Name
  15. <olegbris4@gmail.com>"
  16. oMsg.Subject = "Test from VBScript"
  17. oMsg.TextBody = "If you can read this, the script worked!"
  18.  
  19. ' GMail SMTP server configuration and authentication info
  20. Set oConf = oMsg.Configuration
  21. oConf.Fields(schema & "smtpserver") = "smtp.gmail.com" 'server address
  22. oConf.Fields(schema & "smtpserverport") = 465 'port number
  23. oConf.Fields(schema & "sendusing") = cdoSendUsingPort
  24. oConf.Fields(schema & "smtpauthenticate") = cdoBasic 'authentication
  25. type
  26. oConf.Fields(schema & "smtpusessl") = True 'use SSL
  27. encryption
  28. oConf.Fields(schema & "sendusername") = "brisoleg184@gmail.com" 'sender
  29. username
  30. oConf.Fields(schema & "sendpassword") = "" 'sender password
  31. oConf.Fields.Update()
  32.  
  33. ' send message
  34. oMsg.Send()
  35.  
  36. ' Return status message
  37. If Err Then
  38. resultMessage = "ERROR " & Err.Number & ": " & Err.Description
  39. Err.Clear()
  40. Else
  41. resultMessage = "Message sent ok"
  42. End If
  43.  
  44. Wscript.echo(resultMessage)
Add Comment
Please, Sign In to add comment