<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
">
<!-- 这配置文件大都也是固定的,只要找到一个这样的模板,然后清楚里面的每个参数是代表的什么意思,根据实际情况更改就行了.-->
<!-- 将发送邮件的对象配置为Spring的Bean -->
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<!-- 邮件服务器主机 -->
<property name="host" value="smtp.126.com"/>
<!-- 设置用户名 -->
<property name="username" value="itcast0228"/>
<!-- 设置密码 -->
<property name="password" value="0228itcast"/>
<!-- 邮件属性 -->
<property name="javaMailProperties">
<!-- 说一下这个props标签,现在就在两个文件中用到了这个props标签 -->
<!--
<property name="hibernateProperties">
一个是applicationContext.xml中的关于配置
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">false</prop>
</props>
-->
<props>
<!-- 开启验证 -->
<prop key="mail.smtp.auth">true</prop>
<!-- SMTP协议加密方式 -->
<prop key="mail.smtp.starttls.enable">true</prop>
<!-- 超时时间 -->
<prop key="mail.smtp.timeout">10000</prop>
</props>
</property>
</bean>
</beans>