我在工程的lib目录下发入了log4j.jar / activation.jar / mail.jar
以下是我log4j.xml的配置文件,放在工程的classes目录下:
<?xml version= "1.0 " encoding= "UTF-8 " ?>
<!DOCTYPE configuration>
<configuration xmlns= "http://jakarta.apache.org/log4j/ ">
<appender name= "MAIL_LOG " class= "org.apache.log4j.net.SMTPAppender ">
<param name= "BufferSize " value= "1 "/>
<param name= "SMTPHost " value= "smtp.163.com "/>
<param name= "From " value= "test@163.com "/>
<param name= "To " value= "test@163.com "/>
<param name= "Subject " value= "Tools Application message "/>
<layout class= "org.apache.log4j.PatternLayout ">
<param name= "ConversionPattern " value= "%d %-5p [%t] %l - %m%n "/>
</layout>
<filter class= "org.apache.log4j.varia.LevelRangeFilter ">
<param name= "LevelMin " value= "DEBUG "/>
<param name= "LevelMax " value= "ERROR "/>
</filter>
</appender>
<root>
<level value= "ALL "/>
<appender-ref ref= "MAIL_LOG "/>
</root>
</configuration>
问题是:为什么我的邮箱收不到邮件阿?是配置有问题吗?
------解决方案--------------------
smtp要邮箱密码
------解决方案--------------------
ding...
------解决方案--------------------
看网上说是要将javamail的类进行改造,加入邮箱代理部分就可以了。
自己搜一下。。。