@Test public void sendSimpleMail() throws Exception { MailBean mailBean = new MailBean(); mailBean.setRecipient("15079150591@163.com"); mailBean.setSubject("测试SpringBootMail"); mailBean.setContent("测试SpringBootMail"); mailUtil.sendSimpleMail(mailBean); }
public void sendSimpleMail(MailBean mailBean) { try { SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); simpleMailMessage.setFrom(MAIL_SENDER); simpleMailMessage.setTo(mailBean.getRecipient()); simpleMailMessage.setSubject(mailBean.getSubject()); simpleMailMessage.setText(mailBean.getContent()); javaMailSender.send(simpleMailMessage); } catch (Exception e) { logger.error("邮件发送失败", e); } }
MailUtil { public void sendSimpleMail(MailBean mailBean) { try { SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); simpleMailMessage.setFrom(MAIL_SENDER); simpleMailMessage.setTo(mailBean.getRecipient()); simpleMailMessage.setSubject(mailBean.getSubject()); simpleMailMessage.setText(mailBean.getContent()); javaMailSender.send(simpleMailMessage); } catch (Exception e) { logger.error("邮件发送失败", e); } } }
MailUtil { public void sendSimpleMail(MailBean mailBean) { try { SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); simpleMailMessage.setFrom(MAIL_SENDER); simpleMailMessage.setTo(mailBean.getRecipient()); simpleMailMessage.setSubject(mailBean.getSubject()); simpleMailMessage.setText(mailBean.getContent()); javaMailSender.send(simpleMailMessage); } catch (Exception e) { logger.error("邮件发送失败", e); } }  }
MailUtil { public void sendSimpleMail(MailBean mailBean) { try { SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); simpleMailMessage.setFrom(MAIL_SENDER); simpleMailMessage.setTo(mailBean.getRecipient()); simpleMailMessage.setSubject(mailBean.getSubject()); simpleMailMessage.setText(mailBean.getContent()); javaMailSender.send(simpleMailMessage); } catch (Exception e) { logger.error("邮件发送失败", e); } }  void sendSimpleMail(MailBean mailBean); void sendHTMLMail(MailBean mailBean); void sendAttachmentMail(MailBean mailBean); void sendInlineMail(MailBean mailBean); void sendTemplateMail(MailBean mailBean); void sendMailByQueue(MailBean mailBean); }
MailUtil { public void sendSimpleMail(MailBean mailBean) { try { SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); simpleMailMessage.setFrom(MAIL_SENDER); simpleMailMessage.setTo(mailBean.getRecipient()); simpleMailMessage.setSubject(mailBean.getSubject()); simpleMailMessage.setText(mailBean.getContent()); javaMailSender.send(simpleMailMessage); } catch (Exception e) { logger.error("邮件发送失败", e); } }  void sendSimpleMail(MailBean mailBean); void sendHTMLMail(MailBean mailBean); void sendAttachmentMail(MailBean mailBean); void sendInlineMail(MailBean mailBean); void sendTemplateMail(MailBean mailBean); void sendMailByQueue(MailBean mailBean);  }