553 Mail from must equal authorized user
com.sun.mail.smtp.SMTPSendFailedException: 553 Mail from must equal authorized user
此异常解决的办法为:
设置MimeMessage里的From,即发件人,其中发件人和authorized user保持一致代码
MimeMessage mailObj = new MimeMessage(Session session);
mailObj.addFrom(new InternetAddress[]{new InternetAddress("")});
Unable to locate provider for protocol: smtp
javax.mail.NoSuchProviderException: Unable to locate provider for protocol: smtp
此异常解决的办法为:
增加依赖的jar包activation-1.1.jar
mail-1.4.jarpom
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>