这不是重复的问题。我已经读了很多问题并尝试了几乎所有答案。 我在client.Send(mail);上收到超时错误;
public void sentEmail()
{
MailAddress fromAddress = new MailAddress("MyEmailAddress");
MailAddress toAddress = new MailAddress("nikunj.jani@outlook.com");
MailMessage mail = new MailMessage(fromAddress.Address, toAddress.Address);
mail.Subject = "Testing";
mail.Body = "contents.";
SmtpClient client = new SmtpClient();
client.Host = "mail.webin.pt";
client.Port = 465;
client.EnableSsl = true;
client.Timeout = 10000;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential("MyEmailAddress", "myPassword");
try
{
client.Send(mail);
}
catch (Exception ex)
{
}
}
答案 0 :(得分:0)
(这可能有助于发现服务器端错误)