我有2个(假装)的电子邮件地址 - 雅虎和Hotmail: [email protected]和[email protected](不实)通过雅虎邮件发送失败
我试图从雅虎发送电子邮件到Hotmail。
基本上我已经尝试了几个其他的电子邮件地址配置 - 都没有成功。
我一直在挖掘几天,下面的代码(从here修改)应该工作,但事实并非如此。
'Sending an email using a remote server
Set Mail = CreateObject("CDO.Message")
'This section provides the configuration information for the remote SMTP server.
'Send the message using the network (SMTP over the network).
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.mail.yahoo.com"
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Use SSL for the connection (True or False)
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
'If your server requires outgoing authentication, uncomment the lines below and use a valid email address and password.
'Basic (clear-text) authentication
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
'Your UserID on the SMTP server
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="[email protected]"
'Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password"
Mail.Configuration.Fields.Update
'End of remote SMTP server configuration section
Mail.Subject="Email subject"
Mail.From="[email protected]"
Mail.To="[email protected]"
Mail.TextBody="This is an email message."
Mail.Send
Set Mail = Nothing
的错误信息是:
线32
CHAR 1
错误服务器拒绝了发件人地址。服务器响应为530 5.7.1需要验证
代码8004020E
源(空)
从@Ansgar Wiechers我已修改代码中的响应之后。 我绝对相信,虚拟数据(XXXX)是有效的,但我仍然得到同样的结果误差如上....
Set Mail = CreateObject("CDO.Message")
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.mail.yahoo.com"
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="[email protected]"
Mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="xxxx"
Mail.Configuration.Fields.Update
Mail.Subject="Email subject"
Mail.From="[email protected]"
Mail.To="[email protected]"
Mail.TextBody="This is an email message."
Mail.Send
Set Mail = Nothing
尝试启用SSL(将'smtpusessl'选项设置为'True')。另外请确保您使用正确的服务器和端口。雅虎应该使用端口25来提交邮件似乎有点奇怪。通常会使用端口465或587。 –
不知道哪些更改smtpusessl或465做了它,但现在它的工作。 –