【问题标题】:`The operation has timed out.` exception when sending mail using ZOHO SMTP configuration`操作已超时`使用 ZOHO SMTP 配置发送邮件时出现异常
【发布时间】:2015-12-09 00:50:18
【问题描述】:

我正在使用ZOHO 邮件服务器通过我的应用程序发送邮件。但它无法连接到服务器并抛出异常The operation has timed out.。以下是我的代码:

public int sendMail(string from, string to, string subject, string messageBody) {
    try {
        SmtpClient client = new SmtpClient();
        client.Port = 465;
        client.Host = "smtp.zoho.com";
        client.EnableSsl = true;
        client.Timeout = 10000;
        client.DeliveryMethod = SmtpDeliveryMethod.Network;
        client.UseDefaultCredentials = false;
        client.Credentials = new System.Net.NetworkCredential(Username, Password);

        MailMessage mm = new MailMessage(from, to, subject, messageBody);
        mm.BodyEncoding = UTF8Encoding.UTF8;
        mm.IsBodyHtml = true;
        mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

        client.Send(mm);
        return 0;
    } catch (Exception) {
        throw;
    }
}

我也尝试使用端口587,这里建议Send email using smtp but operation timed out using ZOHO。但问题依然存在。

Zoho SMTP 配置帮助链接:https://www.zoho.com/mail/help/zoho-smtp.html

【问题讨论】:

    标签: c# .net email smtp zoho


    【解决方案1】:

    超时问题通常与网络、端口问题有关,我没有使用 SSL 或 TLS 方法发送电子邮件的经验,但我也会检查一下,当然我想你在说你尝试 TLS 时更改了端口号.

    【讨论】:

      【解决方案2】:

      在尝试了各种防火墙/防病毒/路由器端口转发、端口扫描器、网站端口检查器后,我发现使用与您的代码几乎相同的代码,我能够成功发送邮件!

      您只需将 smtp 更改为: smtp.zoho.eu

      并移植到: 587

      【讨论】:

        猜你喜欢
        • 2013-12-09
        • 1970-01-01
        • 1970-01-01
        • 2014-05-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-07-10
        相关资源
        最近更新 更多