Tomcat/Spring no longer sending emails to SMTP server using authentication
I've got a strange problem with either tomcat or spring. I put up a major revision to my site and emails are no longer being delivered. I use authsmtp, which requires authentication (so they can properly account for my using of their services). No problem, I have this config in spring:
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="mail.authsmtp.com"/>
<property name="username" value="my_authsmtp_username"/>
<property name="password" value="my_authsmtp_password"/>开发者_Go百科;
</bean>
works great normally. However, now I get this error:
Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 513 5.0.0 Your email system must authenticate before sending mail.
My log4j emails continue to work fine though. A test telnet to port 25 of mail.authsmtp.com worked good with a sample SMTP conversation as well. I did a diff of that mailSender config above with the previous version of the site and there are no differences (was thinking maybe I had a character off in the password). What could be the problem?
The only thing I can think of is that I initially started the server without the username/password elements above (was a bug in our deployment mechanism). So initially actually this made complete sense. Since then I've corrected it and added the username/password elements, but the problem persists. I'm thinking maybe the old config is cached somewhere? Would tomcat cache this anywhere? I've deleted the work and temp directories to no avail. Though I've actually changed the host to abcd1234authsmtp.com and it appropriately failed with this error:
Mail server connection failed; nested exception is javax.mail.MessagingException: Unknown SMTP host: mail.abcd1234authsmtp.com; nested exception is: java.net.UnknownHostException: mail.abcd1234authsmtp.com
So I know I'm working with the correct config and tomcat/spring sees the latest version, for some reason Spring just no longer authenticates... I'm using the same version of Spring (v3.0.2) as before as well. Any ideas?
Try adding
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.starttls.enable">false</prop>
</props>
</property>
`
精彩评论