One ODM server reported an error authentication unsuccessful when sending e-mail with JavaMail, and others were normal
The solution is as follows
Javamailsenderimpl authentication exception: javax.mail.authenticationfailedexception: failed to connect,
open the debug log of JavaMail through properties.setproperty (“mail. Debug”, “true”); You can see that there is a problem of 535.7.3 authentication unsuccessful. You need to add the following settings:
properties.put (“mail. SMTP. Auth”, “true”)
properties.put(“mail.smtp.auth.mechanisms”, “NTLM”);
if it is not a Windows operating system, you need to change NTLM to digest mode
Properties properties = new Properties();
properties.put(“mail.smtp.auth”, “true”);
properties.put(“mail.smtp.auth.mechanisms”, “NTLM”); // If not, change to digest and try
// properties.setproperty (“mail. SMTP. Socketfactory. Class”, “javax. Net. SSL. Sslsocketfactory”)
properties.setProperty(“mail.debug”, “true”);
senderImpl.setJavaMailProperties(properties);
senderimpl.sethost (“IP address”)
senderimpl.setuser name (“authenticated user mailbox”)
senderimpl.setpassword (“corresponding email password”)
//senderImpl.setPort(25);
MimeMessage mailMessage = senderImpl.createMimeMessage();
MimeMessageHelper messageHelper = new MimeMessageHelper(mailMessage,
true, “GBK”);