【问题标题】:Service not available, closing transmission channel. The server response was: Cannot connect to SMTP server服务不可用,正在关闭传输通道。服务器响应是:无法连接到 SMTP 服务器
【发布时间】:2018-09-11 07:42:34
【问题描述】:

我不明白为什么会出现这种错误。

服务不可用,正在关闭传输通道。服务器响应是:无法连接到 SMTP 服务器

MailMessage objeto_mail = new MailMessage();

SmtpClient client = new SmtpClient();
client.Port = 25;
client.Host = "webmail.domain.com";
client.Timeout = 1000000;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = true;

client.Credentials = new System.Net.NetworkCredential("Alert@domain.com", "****");
objeto_mail.From = new MailAddress("Alert@domain.com.com");
objeto_mail.To.Add(new MailAddress("Alert@domain.com"));
objeto_mail.Subject = "Password Recover";
objeto_mail.Body = "Message";
client.Send(objeto_mail);

【问题讨论】:

  • 基本上就是它所说的意思。您的客户端无法与电子邮件服务器通信。这可能是防火墙问题,或者您的主机名或端口不正确,或者电子邮件服务器可能已关闭。或者该地址根本没有公共 (SMTP) 电子邮件服务器。
  • 检查防火墙设置
  • 是的,现在我该做什么??
  • “是的,现在我要做什么??” - 你调查.....
  • 你也有冲突的设置:UseDefaultCredentials = true 然后设置Credentials

标签: c# asp.net


【解决方案1】:

我认为您正在尝试连接到离线主机上的电子邮件服务......或不存在:

$ telnet webmail.domain.com 25
Trying 66.11.232.201...
telnet: connect to address 66.11.232.201: No route to host
$

请注意,它位于 my 系统上,该系统没有任何防火墙规则阻止端口 25 上的传出连接。

【讨论】:

    猜你喜欢
    • 2012-09-25
    • 1970-01-01
    • 1970-01-01
    • 2011-08-17
    • 1970-01-01
    • 2018-01-04
    • 2015-06-13
    相关资源
    最近更新 更多