解决503 Error: need EHLO and AUTH first

javax.mail.MessagingException: 503 Error: need EHLO and AUTH first !

503错误。因为smtp服务器需要授权。在spring的配置中加入<prop key="mail.smtp.auth">true</prop>即可。

 

或者

JavaMailSenderImpl sender = new JavaMailSenderImpl();
Properties javaMailProp = new Properties();
javaMailProp.setProperty("mail.smtp.auth", "true");
sender.setJavaMailProperties(javaMailProp);

 

 

你可能感兴趣的:(error)