qq_慕勒3119543
没有设置【自动导入】的话,需要手动导入依赖。
慕的地3159346
慕码人1399423
我也是这样
java.lang.IllegalStateException: Found multiple @SpringBootConfiguration annotated classes [Generic bean: class [com.neo.demo.HelloApplication]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [F:\QMDownload\mail\spring-mail\target\classes\com\neo\demo\HelloApplication.class], Generic bean: class [com.neo.demo.MailApplication]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [F:\QMDownload\mail\spring-mail\target\classes\com\neo\demo\MailApplication.class]]
jerry4013
看看有没有报错,我出现过类似的情况:因为连接问题(Connection XX)【重点关注配置:邮箱的host、port、以及是否采用ssl加密等】
慕婉清9574617
发送邮件需要开启对应邮箱的授权码
qq_慕婉清9207721
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies>
只是疯狂只是野
spring boot实现邮箱验证码注册
https://blog.csdn.net/IndexMan/article/details/89409512
lhw901013
请问这个问题解决了吗
java.lang.NullPointerException
报的是这个错误,下面是代码内容
try{
Hello h = new Hello();
h.SimpleEmail("shizengs@aliyun.com", "This is Subject", "This is Content");
}catch (Exception e){
System.out.println(e);
}@RestController
public class Hello {
@Value("${spring.mail.username}")
private String from;
@Autowired
private JavaMailSender mailSender;
@RequestMapping(value="/sendEmail", method = RequestMethod.GET)
public void SimpleEmail(String to, String subject, String content){
SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
simpleMailMessage.setTo(to);
simpleMailMessage.setSubject(subject);
simpleMailMessage.setText(content);
simpleMailMessage.setFrom(from);
mailSender.send(simpleMailMessage);
}
}
chenG丨Yu
bobooobobb
用IDEA创建springboot项目的话不会出现这个问题
叶涙
不用,开启邮箱授权码就可以了
真傻
spring boot实现邮箱验证码注册
https://blog.csdn.net/IndexMan/article/details/89409512
秋_秋
qq_青春颠覆谁真命_0
https://jingyan.baidu.com/article/e4d08ffd4df5cf0fd2f60d2f.html,你看看这个,其他都是你一样的,刚刚本来写了好多,最后系统说我有不当用语,我就只能给你发链接了,还有刚刚发我只是测试一下我是不是被针对了
慕沐7999752
我也是这个问题,你解决了没
灵灵妖
慕勒0424635
yml的配置
开开_春风不如你
授权码可以在各种邮箱中获取
max_ytj
哈哈哈,java兼职,我也想,带我
时光1124
我的是spring的项目,在我的接口里面注入是成功的,但是在定时任务里面为null,都是用@AutoWired注入的,这是为什么呢,定时任务类里面其他的service可以注入成功
木子i默
554 DT:SPM 发送的邮件内容包含了未被许可的信息,或被系统识别为垃圾邮件。请检查是否有用户发送病毒或者垃圾邮件;肯定是你发的邮件中有广告性信息,如:诚邀、免费注册之类的敏感词。当敏感词的比重达到一定数值时,就会被识别为垃圾邮件拒发。
北极的大企鹅
https://help.mail.163.com/faqDetail.do?code=d7a5dc8471cd0c0e8b4b8f4f8e49998b374173cfe9171305fa1ce630d7f67ac2cda80145a1742516
慕粉2215567550
spring boot实现邮箱验证码注册
https://blog.csdn.net/IndexMan/article/details/89409512
慕前端808727
网络无法连接
嘿smile秀儿
你这个配置文件是客户端授权码,不要用他的那个要用自己邮箱的授权码
我是因为测试类里面邮箱后缀忘写了