1

我正在尝试让经典的 ASP 页面与 Outlook(Microsoft Web 电子邮件)SMTP 中继一起使用。我收到以下错误:

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 = "xyz@abc.com"  
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 的配置中遗漏了一些东西

4

1 回答 1

0

这是一个确实有效的示例。确保你使用的账户有邮箱,并且发件人地址确实是账户地址。

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

        var msg = new MailMessage();
        msg.Subject = "Hello";
        msg.Body = "Hello Sir";
        msg.From = new MailAddress("no.reply@contoso.com");
        msg.To.Add("user@contoso.com");

        var client = new SmtpClient("smtp.outlook.office365.com");
        client.Port = 587;
        client.Credentials = new NetworkCredential("no.reply@contoso.com", "******");
        client.EnableSsl = true;

        client.Send(msg);
于 2013-04-04T16:52:59.500 回答