logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject Re: Error while sending Mail to smtp.gmail.com
Date Thu, 30 Jul 2009 01:04:43 GMT
My suggestion would be to get email sending working using SmtpClient. There's nothing wrong
with writing your own Appender. Here's one that I use for sending low volume ERROR and FATAL
messages in a Medium Trust hosting environment:

    public class MediumTrustSmtpAppender : AppenderSkeleton
    {
        public string From { get; set;}
        public string To { get; set;}
        public string Subject { get; set;}
        public string Host { get; set;}

        protected override void Append(LoggingEvent loggingEvent)
        {
            MailMessage mailMessage = new MailMessage(From, To, Subject, RenderLoggingEvent(loggingEvent));
            SmtpClient smtpClient = new SmtpClient(Host);
            smtpClient.Send(mailMessage);
        }
    }




________________________________
From: Sree <sree.optust@gmail.com>
To: Log4NET User <log4net-user@logging.apache.org>
Sent: Tuesday, July 21, 2009 6:30:42 AM
Subject: RE: Error while sending Mail to smtp.gmail.com

 
 
I’ve disabled the windows firewall
& also the antivirus software but sill got the below error…no change… L
 
 
Best regards,
Sree
 
 

________________________________
 
From:Radovan Raszka
[mailto:raszka@hasam.cz] 
Sent: Tuesday, July 21, 2009 3:22
PM
To: Log4NET User
Subject: RE: Error while sending
Mail to smtp.gmail.com
 
One more idea - is there any antivirus /
firewall software on the computer you are doing your tests? It can block
communication - I had to switch outgoing mail checking off somewhere in the
past....
RR
 

________________________________
 
Od:Sree [mailto:sree.optust@gmail.com] 
Odesláno: 21. července 2009 11:02
Komu: ' Log4NET User '
Předmět: RE: Error while sending
Mail to smtp.gmail.com
 
But I’m getting error:
 
 
A first chance exception of type
'System.InvalidOperationException' occurred in log4netTests.exe
log4net:ERROR [SmtpAppender] Error occurred while
sending e-mail notification.
System.Net.Mail.SmtpException: The SMTP server
requires a secure connection or the client was not authenticated. The server
response was: 5.7.0 Must issue a STARTTLS command first. 22sm14461822wfd.8
   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)
   at
log4net.Appender.SmtpAppender.SendEmail(String messageBody)
   at
log4net.Appender.SmtpAppender.SendBuffer(LoggingEvent[] events)
 
 
Do I need to do any other specific settings..
 
Please help me out…and I really Thank for ur responses…
 
Best regards,
Sree
 
 
 

________________________________
 
From:Radovan Raszka
[mailto:raszka@hasam.cz] 
Sent: Tuesday, July 21, 2009 1:15
AM
To: Log4NET User
Subject: RE: Error while sending
Mail to smtp.gmail.com
 
Works for me without any configuration
exception. I had only to change port to 25, why you are trying 465? My
config:
<appendername="SmtpAppender"type="log4net.Appender.SmtpAppender">
<tovalue="raszka@hasam.cz"/>
<fromvalue="myusername@gmail.com "/>
<subjectvalue="test logging message"/>
<smtpHostvalue="smtp.gmail.com"/>
<authenticationvalue= "Basic"/>
<usernamevalue= "username"/>
<passwordvalue= "mypassword"/>
<enablesslvalue="true"/>
<portvalue="25"/>
<bufferSizevalue="512"/>
<lossyvalue="false"/>
<evaluatortype="log4net.Core.LevelEvaluator">
<thresholdvalue="ALL"/>
</evaluator>
<layouttype="log4net.Layout.PatternLayout">
<conversionPatternvalue="%newline%date [%thread] %-5level %logger [%property{NDC}] -
%message%newline%newline%newline"/>
</layout>
</appender>
RR

________________________________
 
Od:Sree [mailto:sree.optust@gmail.com] 
Odesláno: 20. července 2009 9:50
Komu: ' Log4NET User '
Předmět: RE: Error while sending
Mail to smtp.gmail.com
No this also didn’t work out…
 

________________________________
 
From:Radovan Raszka
[mailto:raszka@hasam.cz] 
Sent: Friday, July 17, 2009 4:53
PM
To: Log4NET User
Subject: RE: Error while sending
Mail to smtp.gmail.com
 
strange, this property exists in source
code taken from source repository. But doesn't exist in binary distribution
(even there is no ssl property!), so try to get current sources from
repository, compile and try again....
Radovan
 

________________________________
 
Od:Sree [mailto:sree.optust@gmail.com] 
Odesláno: 17. července 2009 13:09
Komu: ' Log4NET User '
Předmět: RE: Error while sending
Mail to smtp.gmail.com
log4net:ERROR XmlHierarchyConfigurator: Cannot find
Property [enablessl] to set object on [log4net.Appender.SmtpAppender]
 
getting the above error
 
Best regards,
Sree
Mime
View raw message