I don't think you mentioned the part about the application being hosted
on a 3rd party server. Have you verified that you can send mail on that
server?

 using System.Web.Mail;
 MailMessage mailMessage = new MailMessage();
 mailMessage.To = "[EMAIL PROTECTED]";
 mailMessage.From = "[EMAIL PROTECTED]";
 mailMessage.Subject = "Subject";
 mailMessage.Body = "Hello World";
 SmtpServer.Send(mailMessage);

If you can't send mail, I would extend SmtpAppender and override the
SendBuffer method to use something like OpenSMTP:

 http://sourceforge.net/projects/opensmtp-net/

The new implementation would be very similiar to the base one:

http://tinyurl.com/a55ec
http://cvs.apache.org/viewcvs.cgi/logging-log4net/src/Appender/SmtpAppender.cs?rev=1.9&view=markup

On a slightly unreleated note, here's a screen shot of log4net's
SmtpAppender viewed from NLogViewer using nDumbster as a mock
SmtpServer (thanks to Jarek for cleaning up my code):

 http://www.ronosaurus.com/log4net/nlogviewer_ndumbster_log4net.png

That should be helpful in determining what a good bufferSize property
of the SmtpAppender is so it doesn't queue up messages for days then
suddenly attempt to send a giant 200mb email.

--- Usman Uppal <[EMAIL PROTECTED]> wrote:

> Ron, SMTP Appender works on my machine using our internal SMTP host
> but
> when I deploy my code on a hosted server (outside of our environment)
> that is using different SMTP host, it does not work.
> 
> Do we need to have Exchange CDO installed on the hosted server? Any
> other requirements that I should check for?
> 
> Thanks for your help.
> 
> Usman
> 
> -----Original Message-----
> From: Ron Grabowski [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, September 28, 2005 9:55 AM
> To: Log4NET User
> Subject: RE: LOG4NET - SMTP Appender Not Working
> 
> I used nDumbster:
> 
>  http://ndumbster.sourceforge.net/
> 
> to setup a mock SMTP server on my system and I was able to see log
> messages:
> 
>  <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
>   <to value="[EMAIL PROTECTED]" />
>   <from value="[EMAIL PROTECTED]" />
>   <subject value="SmtpAppender Subject" />
>   <smtpHost value="127.0.0.1" />
>   <bufferSize value="1" />
>   <layout type="log4net.Layout.SimpleLayout" />
>   <filter type="log4net.Filter.LevelRangeFilter">
>    <levelMin value="FATAL"/>
>    <levelMax value="FATAL"/>
>   </filter>
>  </appender>
> 
> This is what nDumbster processed:
> 
>  thread-index: AcXEM8in/PUSDjTMRYGRv0fJOIQJAQ==
>  Thread-Topic: SmtpAppender Subject
>  From: <[EMAIL PROTECTED]>
>  To: <[EMAIL PROTECTED]>
>  Subject: SmtpAppender Subject
>  Date: Wed, 28 Sep 2005 09:51:53 -0400
>  Message-ID: <[EMAIL PROTECTED]>
>  MIME-Version: 1.0
>  Content-Type: text/plain;
>  Content-Transfer-Encoding: 7bit
>  X-Mailer: Microsoft CDO for Exchange 2000
>  Content-Class: urn:content-classes:message
>  Importance: normal
>  Priority: normal
>  X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
> 
>  FATAL - Hello World
> 
> --- Usman Uppal <[EMAIL PROTECTED]> wrote:
> 
> > Here is the Config file.
> > Usman
> 
> 

Reply via email to