Email 发送邮件不';不要发送到gmail服务器

Email 发送邮件不';不要发送到gmail服务器,email,asp-classic,Email,Asp Classic,我使用下面的代码在asp页面中发送邮件,但此代码不会发送到gmail服务器,此服务器是否有问题或我在其中出错 <%Set myMail=CreateObject("CDO.Message") myMail.Subject="Sending email with CDO" myMail.From="mymail@mydomain.com" myMail.To="someone@somedomain.com" myMail.TextBody="This is a message." myMai

我使用下面的代码在asp页面中发送邮件,但此代码不会发送到gmail服务器,此服务器是否有问题或我在其中出错

<%Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydomain.com"
myMail.To="someone@somedomain.com"
myMail.TextBody="This is a message."
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
 myMail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpserver")=My SERVER
 myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
%>

Gmail SMTP不使用端口25,它使用端口587

您可能还需要使用用户名和密码进行身份验证

myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") ="yourname@gmail.com"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="yourpassword"
看到这个了吗

让我们看看您是否:

  • 使用Gmail在您的帐户上启用IMAP或POP
  • 我看不到您的代码中的任何地方设置了身份验证
  • 从Gmail获取您的特定帐户使用的确切服务器名称和端口

  • 编辑以确认Lankymart评论。

    当你说它没有发送到gmail时,是服务器出错还是你只是没有收到电子邮件。如果你没有收到错误但没有收到邮件,那么问题很可能是gmail拒绝或隔离了邮件。请确保您有一个域SPF记录,该记录授权此服务器为您的域发送电子邮件。我应该设置用户名和密码吗?因为邮件可以发送到yahoo邮件服务器。有什么区别?如果是,应该是gmail和它的密码吗?也许我误解了你。你是说你不能通过gmail smtp服务器发送外发邮件,还是说你正在通过另一个smtp服务器发送邮件,而带有@gmail.com地址的收件人没有收到这些邮件。如果后者是真的,那么您是否收到任何发送失败报告(反弹)?不必是IMAP,您可以设置使用POP3发送到gmail。是的,您可以,但根据gmail帮助,您必须首先在您的帐户上启用POP或IMAP。