<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="${mail.host}"/>
<property name="username" value="${mail.username}"/>
<property name="password" value="${mail.password}"/>
<property name="defaultEncoding" value="UTF-8"/>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">${mail.smtp.auth}</prop>
<prop key="mail.smtp.timeout">${mail.smtp.timeout}</prop>
</props>
</property>
</bean>
<bean id="templateMessage" class="org.springframework.mail.SimpleMailMessage">
<property name="from" value="${mail.from}"/>
<property name="to" value="${mail.to}"/>
<property name="subject" value="${mail.subject}"/>
</bean>
######### Email config #########
mail.from=xx-dev@china.xx.com
mail.host=192.168.1.203
mail.smtp.auth=false
mail.smtp.timeout=25000
mail.username=
mail.password=
reference: http://static.springframework.org/spring/docs/2.5.x/reference/mail.html
本文介绍了一种使用Spring框架进行邮件发送的配置方法,详细展示了如何通过JavaMailSenderImpl来设置邮件服务器的各项参数,包括主机地址、认证信息及超时设置等。
1125

被折叠的 条评论
为什么被折叠?



