开发者

Apache log4net: How to set CC and BCC addresses to SmtpAppender from config file

开发者 https://www.devze.com 2023-01-18 03:01 出处:网络
I\'ve been trying to add cc and bcc addresses to log4net\'s SmtpAppender but I\'m getting no flair: <appender name=\"Mail\" type=\"log4net.Appender.SmtpAppender\">

I've been trying to add cc and bcc addresses to log4net's SmtpAppender but I'm getting no flair:

<appender name="Mail" type="log4net.Appender.SmtpAppender">
  <to value="nanotaboada@stackoverflow.com" />
  <cc value="spam@stackoverflow.com" />
  <bcc value="junk@stackoverflow.com" />
  <from value="itsme@chucknorris.com" />
  <subject value="Some pearls of wisdom for you" />
  <smtpHost value="localhost" />
  <bufferSize value="4096" />
  <lossy value="false" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%newline%date [%-4level]%message" />
  &l开发者_如何学Ct;/layout>
</appender>

I'm currently using log4net version 1.2.10.0, if anyone could help me out I'd be very glad.


According to this documentation, there is no cc and bcc fields in the SMTP appender.

You can use a semicolon-separated list for the To attribute (which would be almost equivalent to cc). But no solution for bcc.

You could create a class deriving from SmtpAppender, which adds these properties.


There is no bcc or cc, but you can use multiple 'to' addresses.

You actually need to use commas as separators most of the time. For .Net later than 1.1 you need commas, before you need semicolons.

0

精彩评论

暂无评论...
验证码 换一张
取 消