Problem with sending mail behind firewall
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.c开发者_开发技巧om");
client.Credentials = new NetworkCredential("ali.mselmi@server.ru","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("ali.mselmi@gmail.com");
message.From = new MailAddress("ali.mselmi@server.ru");
client.Send(message);
}
}
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...
精彩评论