@Test public void testSend() { doSetUser(); Mail mail = new Mail(); mail.setSubject("[BCMail:会议提醒]"); mail.setContent("[BCMail:提醒内容]\r\n请出准时出席周五的会议！"); mail.setHtml(true); mail.setTo(new String[]{"1287635921@qq.com"}); this.mailService.send(mail); }
public void send(Mail mail) throws MailException { if (mail == null) { return; } if (mail.getTo() == null || mail.getTo().length == 0) { throw new MailSendException("mail.to couldn't be null"); } mailConfig = this.optionService .findActiveOptionItemByGroupKey("bc.mailSender"); if (mailConfig != null) { if (mailConfig.containsKey("async")) { this.setAsync(Boolean.parseBoolean(mailConfig.get("async"))); } } if (logger.isDebugEnabled()) { logger.debug("subject=" + mail.getSubject()); logger.debug("content=" + mail.getContent()); logger.debug("to=" + StringUtils.arrayToCommaDelimitedString(mail.getTo())); logger.debug("cc=" + StringUtils.arrayToCommaDelimitedString(mail.getCc())); logger.debug("bcc=" + StringUtils.arrayToCommaDelimitedString(mail.getBcc())); } if (this.async) { this.sendByAsynchronousMode(mail); } else { this.sendBySynchronousMode(mail, SystemContextHolder.get() .getUserHistory()); } }
MailServiceImpl implements MailService { public void send(Mail mail) throws MailException { if (mail == null) { return; } if (mail.getTo() == null || mail.getTo().length == 0) { throw new MailSendException("mail.to couldn't be null"); } mailConfig = this.optionService .findActiveOptionItemByGroupKey("bc.mailSender"); if (mailConfig != null) { if (mailConfig.containsKey("async")) { this.setAsync(Boolean.parseBoolean(mailConfig.get("async"))); } } if (logger.isDebugEnabled()) { logger.debug("subject=" + mail.getSubject()); logger.debug("content=" + mail.getContent()); logger.debug("to=" + StringUtils.arrayToCommaDelimitedString(mail.getTo())); logger.debug("cc=" + StringUtils.arrayToCommaDelimitedString(mail.getCc())); logger.debug("bcc=" + StringUtils.arrayToCommaDelimitedString(mail.getBcc())); } if (this.async) { this.sendByAsynchronousMode(mail); } else { this.sendBySynchronousMode(mail, SystemContextHolder.get() .getUserHistory()); } } }
MailServiceImpl implements MailService { public void send(Mail mail) throws MailException { if (mail == null) { return; } if (mail.getTo() == null || mail.getTo().length == 0) { throw new MailSendException("mail.to couldn't be null"); } mailConfig = this.optionService .findActiveOptionItemByGroupKey("bc.mailSender"); if (mailConfig != null) { if (mailConfig.containsKey("async")) { this.setAsync(Boolean.parseBoolean(mailConfig.get("async"))); } } if (logger.isDebugEnabled()) { logger.debug("subject=" + mail.getSubject()); logger.debug("content=" + mail.getContent()); logger.debug("to=" + StringUtils.arrayToCommaDelimitedString(mail.getTo())); logger.debug("cc=" + StringUtils.arrayToCommaDelimitedString(mail.getCc())); logger.debug("bcc=" + StringUtils.arrayToCommaDelimitedString(mail.getBcc())); } if (this.async) { this.sendByAsynchronousMode(mail); } else { this.sendBySynchronousMode(mail, SystemContextHolder.get() .getUserHistory()); } }  }
MailServiceImpl implements MailService { public void send(Mail mail) throws MailException { if (mail == null) { return; } if (mail.getTo() == null || mail.getTo().length == 0) { throw new MailSendException("mail.to couldn't be null"); } mailConfig = this.optionService .findActiveOptionItemByGroupKey("bc.mailSender"); if (mailConfig != null) { if (mailConfig.containsKey("async")) { this.setAsync(Boolean.parseBoolean(mailConfig.get("async"))); } } if (logger.isDebugEnabled()) { logger.debug("subject=" + mail.getSubject()); logger.debug("content=" + mail.getContent()); logger.debug("to=" + StringUtils.arrayToCommaDelimitedString(mail.getTo())); logger.debug("cc=" + StringUtils.arrayToCommaDelimitedString(mail.getCc())); logger.debug("bcc=" + StringUtils.arrayToCommaDelimitedString(mail.getBcc())); } if (this.async) { this.sendByAsynchronousMode(mail); } else { this.sendBySynchronousMode(mail, SystemContextHolder.get() .getUserHistory()); } }  void setTaskExecutor(TaskExecutor taskExecutor); void setOperateLogService(OperateLogService operateLogService); void setIdGeneratorService(IdGeneratorService idGeneratorService); void setMailSender(JavaMailSender mailSender); void setTemplateMessage(SimpleMailMessage templateMessage); void setOptionService(OptionService optionService); void setAsync(boolean async); void send(Mail mail); }
MailServiceImpl implements MailService { public void send(Mail mail) throws MailException { if (mail == null) { return; } if (mail.getTo() == null || mail.getTo().length == 0) { throw new MailSendException("mail.to couldn't be null"); } mailConfig = this.optionService .findActiveOptionItemByGroupKey("bc.mailSender"); if (mailConfig != null) { if (mailConfig.containsKey("async")) { this.setAsync(Boolean.parseBoolean(mailConfig.get("async"))); } } if (logger.isDebugEnabled()) { logger.debug("subject=" + mail.getSubject()); logger.debug("content=" + mail.getContent()); logger.debug("to=" + StringUtils.arrayToCommaDelimitedString(mail.getTo())); logger.debug("cc=" + StringUtils.arrayToCommaDelimitedString(mail.getCc())); logger.debug("bcc=" + StringUtils.arrayToCommaDelimitedString(mail.getBcc())); } if (this.async) { this.sendByAsynchronousMode(mail); } else { this.sendBySynchronousMode(mail, SystemContextHolder.get() .getUserHistory()); } }  void setTaskExecutor(TaskExecutor taskExecutor); void setOperateLogService(OperateLogService operateLogService); void setIdGeneratorService(IdGeneratorService idGeneratorService); void setMailSender(JavaMailSender mailSender); void setTemplateMessage(SimpleMailMessage templateMessage); void setOptionService(OptionService optionService); void setAsync(boolean async); void send(Mail mail);  }