在防火墙后面发送邮件时出现问题

发布于 2024-11-06 22:30:29 字数 1137 浏览 4 评论 0原文

我厌倦了通过 SSL 使用 SMTP 发送消息,但仍然有一个例外:

“操作超时”

我的问题是:

  • 如何解决此问题;

  • 如何在防火墙后面发送电子邮件!!!

谢谢,

   public void SendMessage() 
    {
        SmtpClient client = new SmtpClient("servername.ru.alt001.com");
        client.Credentials = new NetworkCredential("[email protected]","password");
        client.Port = 465;
        client.EnableSsl = true;

        MailMessage message = new MailMessage()
        {
            Subject = "Test Message",
            Body = "Hello, this is a test !!! Kind Regards Ali Mselmi"
        };

        message.To.Add("[email protected]");
        message.From = new MailAddress("[email protected]");

        client.Send(message);
    }
}

I'm tired to send message over SSL with SMTP by i still have an exeption :

"Operation timed out"

My questions is :

  • How to resolve this problem;

  • How to send an email behind the firewall !!!

Thanks,

   public void SendMessage() 
    {
        SmtpClient client = new SmtpClient("servername.ru.alt001.com");
        client.Credentials = new NetworkCredential("[email protected]","password");
        client.Port = 465;
        client.EnableSsl = true;

        MailMessage message = new MailMessage()
        {
            Subject = "Test Message",
            Body = "Hello, this is a test !!! Kind Regards Ali Mselmi"
        };

        message.To.Add("[email protected]");
        message.From = new MailAddress("[email protected]");

        client.Send(message);
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜味拾荒者 2024-11-13 22:30:29

这就是防火墙的要点——除非获得允许,否则人们无法访问防火墙后面的端口。

如果确实是问题所在,您需要联系防火墙所有者/管理员。

另一种可能性是您的端口号错误 - 465 是安全 smtp 的旧端口号 - 我相信 587 是推荐的端口...

That's the point of a firewall - people can't reach a port behind it unless they're allowed to.

You'll need to contact the firewall owner/admin if indeed that's the problem.

The other possibility is that you have the wrong port number - 465 is the legacy port number for secure smtp - I believe 587 is the recommended port...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文