我正在用经典的 ASP(是的,请原谅我)编写一个使用 Google Mail 发送电子邮件的应用程序。我让它像这样工作得很好:
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = SendUsername
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = SendPassword
ObjSendMail.Configuration.Fields.Update
ObjSendMail.To = "x@x.x"
ObjSendMail.From = "x@x.x"
ObjSendMail.Subject = "subject here..."
ObjSendMail.HTMLBody = "body here..."
'ObjSendMail.Fields("urn:schemas:mailheader:disposition-notification-to") = SendUsername
'ObjSendMail.Fields("urn:schemas:mailheader:return-receipt-to") = SendUsername
'ObjSendMail.Fields.Update
'ObjSendMail.DSNOptions = 14
ObjSendMail.Send
Set ObjSendMail = Nothing
当我取消注释以下行时:
'ObjSendMail.Fields("urn:schemas:mailheader:disposition-notification-to") = SendUsername
'ObjSendMail.Fields("urn:schemas:mailheader:return-receipt-to") = SendUsername
'ObjSendMail.Fields.Update
'ObjSendMail.DSNOptions = 14
电子邮件发送失败。没有错误,只是没有电子邮件,也没有收据。我一生都无法弄清楚如何使这项工作。“SendUsername”是一个有效的电子邮件地址。任何帮助,将不胜感激。