我的代码适用于 Outlook 邮件服务器,但对于 webmail.ferozo,它需要很长时间才能执行,并且在完成时会生成以下错误:
Unhandled exception. System.Net.Mail.SmtpException: The operation has timed out.
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at EnviarMail.SendMail.EnvioCorreo2(String to, String asunto, String body, String displayName) in C:\Users\Public\Documents\Proyectos\Envio de correos\Logic.cs:line 55
at EnviarMail.Program.Main() in C:\Users\Public\Documents\Proyectos\Envio de correos\Program.cs:line 16
这是我用来发送邮件的代码
SmtpClient client = new SmtpClient("mail server", PORT NUMBER);
client.Credentials = new NetworkCredential(serder, password);
client.EnableSsl = true;
MailMessage correo = new MailMessage();
correo.From = new MailAddress(serder);
correo.To.Add(receiverd);
correo.Subject = subject;
correo.IsBodyHtml = true;
correo.Body = body;
client.Send(correo);