<bean name="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="smtp.gmail.com"/>
<property name="port" value="465"/>
<property name="username" value="yourUserName@gmail.com"/>
<property name="password" value="yourPassword"/>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
</props>
</property>
</bean>
tips:
本文由wp2Blog导入,原文链接:http://devonios.com/%e4%bd%bf%e7%94%a8spring-mail-%e6%a8%a1%e5%9d%97%e8%bf%9e%e6%8e%a5stmp%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%8f%91%e9%80%81%e9%82%ae%e4%bb%b6.html