1、Unable to locate provider for protocol: smtp –>缺少依赖造成的
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.0.2</version>
</dependency>
2、501 mail from address must be same as authorization user –>这是因为没有设置邮件发送者,发送邮件必须要有发送者的:
mailMsg.setFrom("1573876303@qq.com");
3、javax.mail.AuthenticationFailedException –>设置没有问题的话,绝对是账户密码出错的问题
时间: 2024-10-25 08:32:56