Ten błąd występuje, gdy często wysyłam wiadomości e-mail do listy użytkowników. Załóżmy, że wysyła 10 e-maili i 1 daje błąd, a następnie wysyła kilka kolejnych wiadomości i podaje ten sam błąd.System.Net.Mail.SmtpException: Usługa niedostępna, zamykanie kanału transmisji. Odpowiedź serwera: 4.4.2
Kod wygląda następująco:
public static bool SendEmail(string toMail, string fromname, string from, string subject, string body, string BCC)
{
MailMessage mailmessage = new MailMessage("[email protected]", toMail, subject, body);
mailmessage.IsBodyHtml = true;
mailmessage.BodyEncoding = Encoding.GetEncoding(1254);
mailmessage.SubjectEncoding = Encoding.GetEncoding(1254);
SmtpClient objCompose = new SmtpClient("xxxx");
try
{
objCompose.Send(mailmessage);
return true;
}
catch (Exception ex) {
}
return false;
}
A błąd jest to:
System.Net.Mail.SmtpException: Service not available, closing transmission channel. The server response was: 4.4.2 mailer.mailer.com Error: timeout exceeded at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message)
może ktoś proszę o pomoc, ten bug mnie zabija.
Z góry dziękuję.
MailMessage.Dispose() (.NET 3.5) – garik
Nie działa dla mnie. Cóż ... pozbyłem się wyjątku, ale teraz po prostu się zawiesza, gdy ktoś wysyła e-mail lub dwa. Błąd –