Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. Sub SendGMail()
  2.  
  3. ' Object creation
  4. Set objMessage = CreateObject("CDO.Message")
  5. Set msgConf = CreateObject("CDO.Configuration")
  6.  
  7. ' Server Configuration
  8. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  9. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
  10. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
  11. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
  12. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "frantag@gmail.com"
  13. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Heslo123"
  14. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
  15. msgConf.Fields.Update
  16.  
  17. ' Email
  18. objMsg.To = "franta@montix.cz"
  19. objMsg.From = "montixpacking@gmail.com"
  20. objMsg.Subject = "Test send with Gmail account"
  21. objMsg.HTMLBody = "Fili, balení tě postrádá."
  22. objMsg.Sender = "Packing"
  23.  
  24. Set objMsg.Configuration = msgConf
  25.  
  26. ' Send
  27. objMsg.Send
  28.  
  29. ' Clear
  30. Set objMsg = Nothing
  31. Set msgConf = Nothing
  32.  
  33. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement