2013-04-02 73 views
1

我想要獲得與Outlook(微軟Web電子郵件)SMTP中繼工作的經典ASP頁面。我收到以下錯誤:經典的ASP電子郵件不能與Outlook中繼

CDO.Message.1 error '80040213' 
The transport failed to connect to the server. 

我的代碼看起來像

dim objEmail     
Set objEmail = Server.CreateObject("cdo.message") 
objEmail.To = list 
objEmail.From = "[email protected]" 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = username 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = password 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587 
objEmail.Configuration.Fields.Update 
objEmail.Send 

我的Gmail測試,這件事情片斷正常工作與它。我想我在配置Outlook中缺少一些東西SMTP

+0

你可以啓用這個「cdo」郵件程序的詳細日誌並查看與服務器的詳細對話嗎? GMAIL很可能不會100%與Microsoft的實施/設置兼容。 –

回答

0

下面是一個可以工作的例子。確保您使用的帳戶有一個郵箱,而來自地址的確實是帳戶地址。

 ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true; 

     var msg = new MailMessage(); 
     msg.Subject = "Hello"; 
     msg.Body = "Hello Sir"; 
     msg.From = new MailAddress("[email protected]"); 
     msg.To.Add("[email protected]"); 

     var client = new SmtpClient("smtp.outlook.office365.com"); 
     client.Port = 587; 
     client.Credentials = new NetworkCredential("[email protected]", "******"); 
     client.EnableSsl = true; 

     client.Send(msg); 
+0

我知道它在ASP.NET中正常工作,但我正在談論傳統的ASP。 – Sabby62

相關問題