I'm trying to make SmtpClient send mails, but it always ends up with a timeout :(
The settings I use work in Mozilla Thunderbird, so I'm 100% sure the problem is in my code. I just cannot see where the problem is.
This is my code:
MailMessage email = new MailMessage(fromAddress, to, subject, body);
SmtpClient smtp = new SmtpClient();
smtp.Host = HOSTNAME;
smtp.Port = PORT;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential(USERNAME, PASSWORD)
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.EnableSsl = true;
smtp.Timeout = 10000;
smtp.Send(email);
Any ideas what might be going wrong?
The settings have been double checked to make sure they are correct. And I copied them from the code to Thunderbird when I tested sending mails in Thunderbird (i.e. I'm 100% sure the settings are correct).
Thanks!