环境
jdk1.8
activation.jar
javax.mail-1.6.2.jar
log4j-1.2.12.jar
commons-logging-1.1.1.jar
配置
开启服务
以qq邮箱为例,开启POP3/SMTP-IMAP/SMTP服务
邮箱-设置-账户
生成授权码之后一定要记住,代码中会用到
代码
com.email.util下EmailUtil.java
1 | package com.email.util; |
com.email.util下EmailPropertiesUtil.java
1 | package com.email.util; |
com.email.util下email.properties
1 | mail.smtp.host=smtp.qq.com |
src下log4j.properties
1 | log4j.logger.com.opslab.util = ERROR |