端口号的操作超时

时间:2014-01-03 09:53:22

标签: c# asp.net vb.net

我尝试使用以下代码发送邮件:

MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("mailserver");

mail.From = new MailAddress("mailid");
mail.To.Add("mailid");
mail.Subject = "Test";
mail.Body = "Report";

//Console.WriteLine(SmtpServer.Port +"......"+ SmtpServer.Host);

SmtpServer.Port = 465;

SmtpServer.Credentials = new System.Net.NetworkCredential("mailid", "pwd");
SmtpServer.EnableSsl = true;
SmtpServer.Timeout = 40000;
SmtpServer.Send(mail);

例外:

  

端口号的操作超时465端口,适用于港口号码。 587

0 个答案:

没有答案