On the Log4Net Config Examples webpage it shows examples on how to setup a SmtpAppender.
So I added the following settings into my app.config file, and it successfully sends an Email when a Warning or higher is logged (which is good).
<appender name="EmailAppender" type="log4net.Appender.SmtpAppender">
<to value="[email protected]" />
<from value="[email protected]" />
<subject value="test logging message" />
<smtpHost value="smtpserver.mycompany.com" />
<lossy value="true" />
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="WARN"/>
</evaluator>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline%newline%newline" />
</layout>
</appender>
But the From value is hard coded with my Email address.
My application is a WinForms app and it's going to be deployed to users PC's, so it would be very handy to know which user encountered the warning / error.
Is is possible to set up a Log4Net SmtpAppender so that the From value uses the current users Email Address?
Thank you for your help.