maven依赖
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.6.0-rc1</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.0-rc1</version>
</dependency>
spring SendMail
<bean id="mailSSLSocketFactory" class="com.sun.mail.util.MailSSLSocketFactory">
<property name="trustAllHosts" value="true"></property>
</bean>
<bean id="javaMailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="javaMailProperties">
<map>
<entry key="mail.smtp.auth" value="true"></entry>
<entry key="mail.smtp.timeout" value="25000"></entry>
<entry key="mail.debug" value="false"></entry>
<entry key="mail.smtp.ssl.enable" value="true"></entry>
<entry key="mail.smtp.port" value="465"></entry>
<entry key="mail.smtp.ssl.socketFactory" value-ref="mailSSLSocketFactory" ></entry>
</map>
</property>
<property name="host" value="smtp.qq.com" />
<property name="username" value="service@qq.com" />
<property name="password" value="psw" />
</bean>
作者
jnan77
发表于
2017-05-12 13:36:55
,最后修改于
2017-05-15 09:42:22
Comments