vb发送Gmail邮件

使用vb来发送Gmail邮件,配合windows2003的performance来做进程监控,很实用也很方便,进程控制也可以,脚本的主要作用是发送邮件通知,触发动作可由performance来完成.

  1. Set iMsg = CreateObject("CDO.Message")
  2. Set iConf = CreateObject("CDO.Configuration")
  3. Set Flds = iConf.Fields
  4. schema = "http://schemas.microsoft.com/cdo/configuration/"
  5. Flds.Item(schema & "sendusing") = 2
  6. Flds.Item(schema & "smtpserver") = "smtp.gmail.com" 
  7. Flds.Item(schema & "smtpserverport") = 465
  8. Flds.Item(schema & "smtpauthenticate") = 1
  9. Flds.Item(schema & "sendusername") = "YourEmailAddress"
  10. Flds.Item(schema & "sendpassword")"YourPassWord"
  11. Flds.Item(schema & "smtpusessl") = 1
  12. Flds.Update
  13. With iMsg
  14. .To = "Recipients"
  15. .From = "YourName <YourEmailAddress>"
  16. .Subject = "Email Title"
  17. .HTMLBody = "YourMessageGoesHere"
  18. .Sender = "YourName"
  19. .Organization = "YourName"
  20. .ReplyTo = "Recipients"
  21. Set .Configuration = iConf
  22. SendEmailGmail = .Send
  23. End With
  24.  
  25. set iMsg = nothing
  26. set iConf = nothing
  27. set Flds = nothing

3 Comments

  1. 现在还能运行吗? Gmail 允许脚本连接吗? 我测试了多次脚本都是 连不上服务器

  2. 好像不能上传附件啊

  3. 技术很强啊