test_class.declarator: logger = LoggerFactory.getLogger("mailLogs")
test_class.original_string: Logger logger = LoggerFactory.getLogger("mailLogs");
test_class.type: Logger
test_class.var_name: logger
test_class.declarator: mailService
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private MailService mailService;
test_class.type: MailService
test_class.var_name: mailService
test_class.file: CheckDomain/src/test/java/me/ffis/checkdomain/service/impl/MailServiceImplTest.java
test_class.identifier: MailServiceImplTest
test_case.body: @Test
      public void sendMailTest() {
          MailTemplateModel model = new MailTemplateModel();
          model.setDomain("ffis.me");
          model.setTime(new Date());
          model.setStatus("Domain name is available 表示域名可以注册");
          mailService.sendSimpleMail(model, "ffis.me");
      }
test_case.class_method_signature: MailServiceImplTest.sendMailTest()
test_case.full_signature: @Test public void sendMailTest()
test_case.identifier: sendMailTest
test_case.invocations: setDomain setTime setStatus sendSimpleMail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void sendMailTest()
focal_class.declarator: maillogger = LoggerUtils.Logger(LogFileName.MAIL_LOGS)
focal_class.modifier: private final
focal_class.original_string: private final Logger maillogger = LoggerUtils.Logger(LogFileName.MAIL_LOGS);
focal_class.type: Logger
focal_class.var_name: maillogger
focal_class.declarator: mailSender
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private JavaMailSender mailSender;
focal_class.type: JavaMailSender
focal_class.var_name: mailSender
focal_class.declarator: javaMailSender
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private JavaMailSender javaMailSender;
focal_class.type: JavaMailSender
focal_class.var_name: javaMailSender
focal_class.declarator: MAIL_SENDER
focal_class.modifier: @Value("${customize.mail.sender}")
      private
focal_class.original_string: @Value("${customize.mail.sender}")
      private String MAIL_SENDER;
focal_class.type: String
focal_class.var_name: MAIL_SENDER
focal_class.declarator: SENDER_NAME
focal_class.modifier: @Value("${customize.mail.senderName}")
      private
focal_class.original_string: @Value("${customize.mail.senderName}")
      private String SENDER_NAME;
focal_class.type: String
focal_class.var_name: SENDER_NAME
focal_class.declarator: freeMarkerConfigurer
focal_class.modifier: @Autowired
focal_class.original_string: @Autowired
      FreeMarkerConfigurer freeMarkerConfigurer;
focal_class.type: FreeMarkerConfigurer
focal_class.var_name: freeMarkerConfigurer
focal_class.file: CheckDomain/src/main/java/me/ffis/checkdomain/service/impl/MailServiceImpl.java
focal_class.identifier: MailServiceImpl
focal_class.interfaces: implements MailService
focal_class.class_method_signature: MailServiceImpl.sendSimpleMail(MailTemplateModel model, String email)
focal_class.full_signature: @Async @Override public void sendSimpleMail(MailTemplateModel model, String email)
focal_class.identifier: sendSimpleMail
focal_class.modifiers: @Async @Override public
focal_class.parameters: (MailTemplateModel model, String email)
focal_class.return: void
focal_class.signature: void sendSimpleMail(MailTemplateModel model, String email)
focal_class.class_method_signature: MailServiceImpl.getMailHtml(MailTemplateModel mailTemplateModel)
focal_class.full_signature: @Override public String getMailHtml(MailTemplateModel mailTemplateModel)
focal_class.identifier: getMailHtml
focal_class.modifiers: @Override public
focal_class.parameters: (MailTemplateModel mailTemplateModel)
focal_class.return: String
focal_class.signature: String getMailHtml(MailTemplateModel mailTemplateModel)
focal_method.body: @Async
      @Override
      public void sendSimpleMail(MailTemplateModel model, String email) {
          try {
              //获取MimeMessage对象
              MimeMessage message = javaMailSender.createMimeMessage();
              MimeMessageHelper helper = new MimeMessageHelper(message, true);
              if (MAIL_SENDER == null) {
                  log.error("邮件收信人不能为空");
                  throw new RuntimeException("邮件收信人不能为空");
              }
              //设置邮件发送人昵称的encode编码
              try {
                  SENDER_NAME = MimeUtility.encodeText(SENDER_NAME);
              } catch (UnsupportedEncodingException e) {
                  e.printStackTrace();
                  log.error("编码异常", e);
              }
              //邮件发送人+中文昵称
              helper.setFrom(new InternetAddress(SENDER_NAME + " <" + MAIL_SENDER + ">"));
              //邮件接收人
              helper.setTo(email);
              //邮件主题
              helper.setSubject("域名注册监控：您心仪的域名 " + model.getDomain() + " 现在可以注册辣！");
              //邮件内容
              //获取邮件模板
              String mailHtml = this.getMailHtml(model);
              if (mailHtml == null) {
                  log.error("获取到的邮件模板为空");
                  throw new RuntimeException("获取到的邮件模板为空");
              }
              helper.setText(mailHtml, true);
              //发送邮件
              mailSender.send(message);
              //记录发送邮件日志
              maillogger.info(model.getDomain() + " is available, successfully sent an email to " + email);
              //log.info(model.getDomain() + " is available, successfully sent an email to " + email);
          } catch (Exception e) {
              e.printStackTrace();
              log.error("邮件发送失败", e);
          }
      }
focal_method.class_method_signature: MailServiceImpl.sendSimpleMail(MailTemplateModel model, String email)
focal_method.full_signature: @Async @Override public void sendSimpleMail(MailTemplateModel model, String email)
focal_method.identifier: sendSimpleMail
focal_method.invocations: createMimeMessage error encodeText printStackTrace error setFrom setTo setSubject ; getMailHtml error setText send info getDomain printStackTrace error
focal_method.modifiers: @Async @Override public
focal_method.parameters: (MailTemplateModel model, String email)
focal_method.return: void
focal_method.signature: void sendSimpleMail(MailTemplateModel model, String email)