org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Unknown SMTP host: smtp.163.com; nested exception is: java.net.UnknownHostException: smtp.163.com
我的applicationContext-quartz.xml里边这样配置的:
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="defaultEncoding" value="${mail.encoding}" />
<property name="host" value="${mail.host}" />
<property name="username" value="${mail.username}" />
<property name="password" value="${mail.password}" />
<property name="protocol" value="${mail.protocal}" />
<property name="javaMailProperties">
<props>
<!-- 让服务器检验用户密码是否正确 -->
<prop key="mail.smtp.auth">${mail.auth}</prop>
<!-- 邮件发送延时时间-->
<prop key="mail.smtp.timeout">${mail.timeout}</prop>
<prop key="mail.debug">${mail.debug}</prop>
<prop key="mail.smtp.ssl.enable">${mail.ssl.enable}</prop>
<prop key="mail.smtp.socks.host">${mail.socks.host}</prop>
<prop key="mail.smtp.socks.port">${mail.socks.port}</prop>
<prop key="mail.smtp.socketFactory.class">${mail.socketFactory}</prop>
</props>
</property>
</bean>
下边是config.properties文件里的javamail配置参数的内容:
mail.encoding=utf-8
mail.host=smtp.163.com
[email protected]
mail.password=jbS18382
mail.protocal=smtp
mail.auth=true
mail.timeout=180000
mail.debug=true
mail.ssl.enable=true
mail.socks.host=cmproxy.gmcc.net
mail.socks.port=8081
mail.socketFactory=javax.net.ssl.SSLSocketFactory
求大神帮忙啊, 谢谢,谢谢!!! 急啊!!!
第一次写这个东西, javamail的配置参数是从网上搜的,也不知道对不对。