[ 
https://issues.apache.org/jira/browse/LOG4NET-474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14738254#comment-14738254
 ] 

Dominik Psenner commented on LOG4NET-474:
-----------------------------------------

System.IO.IOException: Unable to read data from the transport connection: 
net_io_connectionclosed.

This error message indicates a networking problem. The connection may have been 
lost while sending the mail message to the server.

{code}
using(SmtpClient c = new SmtpClient())
{ //do stuff to send email }
{code}

This is not implemented because SmtpClient did not implement IDisposable until 
.NET 4.0 and we do have support for older .NET frameworks. We'll yet have to 
work out if SmtpClient actually releases any information on disposal. Probably 
it is not because it would be a regression when migrating code to .NET 4.0 from 
previous .NET versions and such regressions are taken very serious by MS.

> log4net:ERROR [SmtpAppender] ErrorCode: GenericFailure. Error occurred while 
> sending e-mail notification.
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-474
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-474
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>         Environment: Microsoft Windows Server 2012, Running in part of 
> windows service.
>            Reporter: David Rankin
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> Error happens when trying to send emails.
> I have checked github source here to try help with this problem.
> https://github.com/apache/log4net/blob/782e8267dc44a3db5e0b095c91c1de76a37a9e9b/src/log4net/Appender/SmtpAppender.cs
> If you wrap the SmtpClient (on Line 394 ) It should probably fix this issue. 
> Thats just from my experience. Please let me know if you need anthing else?
> Please see the error log from my debug console.
> log4net:ERROR [SmtpAppender] ErrorCode: GenericFailure. Error occurred while 
> sending e-mail notification.
> System.Net.Mail.SmtpException: Failure sending mail. ---> 
> System.IO.IOException: Unable to read data from the transport connection: 
> net_io_connectionclosed.
>    at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 
> offset, Int32 read, Boolean readLine)
>    at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader 
> caller, Boolean oneLine)
>    at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
>    at System.Net.Mail.CheckCommand.Send(SmtpConnection conn, String& response)
>    at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, 
> MailAddress from, Boolean allowUnicode)
>    at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, 
> MailAddressCollection recipients, String deliveryNotify, Boolean 
> allowUnicode, SmtpFailedRecipientException& exception)
>    at System.Net.Mail.SmtpClient.Send(MailMessage message)
>    --- End of inner exception stack trace ---
>    at System.Net.Mail.SmtpClient.Send(MailMessage message)
>    at log4net.Appender.SmtpAppender.SendEmail(String messageBody)
>    at log4net.Appender.SmtpAppender.SendBuffer(LoggingEvent[] events)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to