我有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做了它,但現在它的工作。 –