【问题标题】:Classic ASP emails not working with Outlook SMTP relay经典 ASP 电子邮件不适用于 Outlook SMTP 中继
【发布时间】:2015-11-06 02:20:38
【问题描述】:

我正在尝试让经典 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 进行了测试,这个东西 sn-p 可以正常工作。我想我在 Outlook SMTP 的配置中遗漏了一些东西

【问题讨论】:

  • 您能否启用此“cdo”邮件程序的详细日志记录并查看与服务器的详细对话? GMAIL 很可能不会 100% 兼容微软的实现/设置。

标签: email asp-classic smtp office365


【解决方案1】:

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

        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);

【讨论】:

  • 我知道它在 ASP.NET 中运行良好,但我说的是经典 ASP。
猜你喜欢
  • 2011-01-17
  • 2012-12-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-12-01
  • 2013-08-16
  • 1970-01-01
  • 2013-07-28
相关资源
最近更新 更多