在防火墙后面发送邮件时出现问题
我厌倦了通过 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是防火墙的要点——除非获得允许,否则人们无法访问防火墙后面的端口。
如果确实是问题所在,您需要联系防火墙所有者/管理员。
另一种可能性是您的端口号错误 - 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...