मुझे यह त्रुटि तब मिलती है जब मैं अक्सर उपयोगकर्ताओं की सूची में कुछ ई-मेल भेज रहा हूं। मान लें कि यह 10 मेल भेजता है और 1 त्रुटि देता है, फिर कुछ और मेल भेजता है और एक ही त्रुटि देता है।System.Net.Mail.SmtpException: सेवा उपलब्ध नहीं है, ट्रांसमिशन चैनल बंद कर रहा है। सर्वर प्रतिक्रिया थी: 4.4.2
कोड इस तरह दिखता है:
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;
}
और त्रुटि मैं यह है:
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)
किसी को भी कृपया मदद कर सकते हैं, इस बग मुझे मार रहा है।
अग्रिम धन्यवाद।
MailMessage.Dispose() (.NET 3.5) – garik
मेरे लिए काम नहीं किया। खैर ... यह अपवाद से छुटकारा पा लिया लेकिन अब जब कोई ईमेल या दो भेजता है तो यह लटकता है। –