log4net Mail Sending
In the previous article we mainly introduce log4net generated text format, this article mainly configures the mailbox to send. Reference to the project, build we are not described, if not very clear, please look at the article,
The usual, we now add a appender to the config file about mailbox sending:
<!--email send-<appender name="Smtpappender"Type="log4net. Appender.smtpappender"> <authentication value="Basic"/> <!--<to value="mailbox that accepts mail"/> < fromValue="the mailbox that sent the message"/> <username value="the mailbox that sent the message"/> <password value="password to send the message"/> <subject value="XXX Application error log messages"/>--> <to value="[email protected]"/> < fromValue="1***@163.com"/> <username value="1***@163.com"/> <!--for client authorization codes-<password value="***********"/> <subject value="Log Messages"/> <!--<smtphost value="smtp.exmail.qq.com"/>--> <smtphost value="smtp.163.com"/> <lossy value="true"/> <evaluator type="log4net. Core.levelevaluator"> <threshold value="DEBUG"/> </evaluator> <layout type="log4net. Layout.patternlayout"> <conversionpattern value="%newline%n Recording time:%date%n thread Id:[%thread]%n log level:%-5level%n Log Description:%message%newline %n"/> </layout> </appender> <!--mailbox Important logs::: Important logs. -<logger Name="LOGDEBUGSMTP"> <level value="DEBUG"/> <appender-ref ref="Smtpappender"/> </logger>
Warm tip: The configuration of the authorization code here, not the password, about the authorization code how to get, you must be confused, don't worry, I give you to parse
<!--for client authorization code--<password value="*********" />
To obtain the authorization code step:
First step: Enter the authorization page
Part II:
Part III: Send SMS
Then follow the prompts to define your own authorization code ....
log4net Mail Sample Send
Send Results Example: 163 mailbox sent to QQ mailbox
- Bo Master is the use of reading, reference, quoting, copying, copying and pasting a variety of ways to make their own pure 24k article, please forgive bloggers become a shameless document Porter!
- Younger brother just entered the blog writing, the text if there is not, welcome to use the board to straighten, hope to help you.
Log4net Series II: Log4net mail Log