@Autowired private JavaMailSender javaMailSender; public String sendEmail(ToMail toMail){ SimpleMailMessage message = new SimpleMailMessage(); message.setFrom("[email protected]"); message.setTo("[email protected]"); message.setSubject("尊敬的用户您好"); message.setText("扫描完毕"); try { javaMailSender.send(message); } catch (MailException e) { e.printStackTrace(); return "发送失败"; } return "发送成功"; }
标签:javaMailSender,return,springboot,发送,SimpleMailMessage,message,邮件 From: https://www.cnblogs.com/caoaman/p/17363334.html