查看: 642|回复: 0

[文章教程] ASP 利用CDO.Message发送带附件的邮件示范

[复制链接]
xuanxiao 发表于 2021-9-6 23:57:29 | 显示全部楼层 |阅读模式
  1. <%
  2. dim ttasp
  3. dim Attachment

  4. Attachment =server.MapPath("0410.rar")
  5. ttasp="测试看看"

  6. dim objMail
  7. Set objMail = Server.CreateObject("CDO.Message")

  8. smtpServer ="smtp.exmail.qq.com"
  9. yourEmail ="support@ttasp.com"
  10. yourPassword ="771"

  11. sendEmailTo ="774658@qq.com"'收件人EMai

  12. objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  13. objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
  14. objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
  15. objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
  16. objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
  17. objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = yourEmail
  18. objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = yourPassword
  19. objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60


  20. objMail.Configuration.Fields.Update


  21. objMail.From = yourEmail
  22. objMail.To = sendEmailTo

  23. objMail.Subject= "新家教编号"
  24. objMail.htmlBody = ttasp
  25. objMail.AddAttachment(Attachment)

  26. objMail.Send
  27. Set objMail = Nothing

  28. response.Write("ok")
  29. %>

复制代码


亲测有效
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表

在线客服

售前咨询
售后咨询
服务热线
023-58418553
微信公众号