/**
   * 이메일을 전송한다.
   *
   * @param mntrngLog 모니터링 대상정보
   * @return
   */
  private void sendEmail(DbMntrngLog mntrngLog) {
    String subject = null;
    String text = null;
    String errorContents = null;

    SimpleMailMessage msg = new SimpleMailMessage(this.mntrngMessage);
    // 수신자
    msg.setTo(mntrngLog.getMngrEmailAddr());
    // 메일제목
    subject = msg.getSubject();
    subject = EgovStringUtil.replace(subject, "{모니터링종류}", "DB서비스모니터링");
    msg.setSubject(subject);
    // 메일내용
    text = msg.getText();
    text = EgovStringUtil.replace(text, "{모니터링종류}", "DB서비스모니터링");
    errorContents = "데이타소스명 : " + mntrngLog.getDataSourcNm() + "\n";
    errorContents = errorContents + "서버명  : " + mntrngLog.getServerNm() + "\n";
    errorContents = errorContents + "DBMS종류 : " + mntrngLog.getDbmsKindNm() + "\n";
    errorContents = errorContents + "체크SQL : " + mntrngLog.getCeckSql() + "\n";
    errorContents = errorContents + "상태 : " + mntrngLog.getMntrngSttusNm() + "\n";
    errorContents = errorContents + "모니터링시각 : " + mntrngLog.getCreatDt() + "\n";
    errorContents = errorContents + "에러메시지 : " + mntrngLog.getLogInfo() + "\n";
    text = EgovStringUtil.replace(text, "{에러내용}", errorContents);
    msg.setText(text);

    this.mntrngMailSender.send(msg);
  }
 private void sendMailMessage(final SimpleMailMessage msg, final Long creatorId) {
   OutboundMail out = new OutboundMail();
   out.setCreator(creatorId);
   out.setMessageBody(msg.getText());
   out.setTo(msg.getTo());
   sendMailMessage(msg, out);
 }
Esempio n. 3
0
 @Override
 public void send(SimpleMailMessage mailMessage) throws MailException {
   StringBuffer mail = new StringBuffer();
   mail.append(this.getMailHeader(mailMessage) + "\n");
   mail.append(mailMessage.getText());
   logger.info(mail.toString());
 }
 private void logMail(SimpleMailMessage msg) {
   log.info(
       "Mail Test-Mode: Would send mail to="
           + arrayToString(msg.getTo())
           + " with subject="
           + msg.getSubject());
   log.debug(
       "Mail Test-Mode: from="
           + msg.getFrom()
           + " , cc="
           + msg.getCc()
           + " , reply-to="
           + msg.getReplyTo());
   log.debug("Mail Test-Mode: text='" + msg.getText() + "'");
 }