/**    メールを送信する。
  *
  *    念のため、To、Cc、Bccのデータにコントロールコードが入っているかどうかをチェックしている。
  *    コントロールコードが見つかればfalseを返し送信はしないものとする。
  *
  * @return boolean メールが送信できればtrue、送信できなければFALSE
  */
 public function send()
 {
     if ($this->checkControlCodeNothing($this->toField)) {
         $this->errorMessage = '宛先の情報にコントロールコードが含まれています。';
         return false;
     }
     if ($this->checkControlCodeNothing($this->ccField)) {
         $this->errorMessage = '宛先の情報にコントロールコードが含まれています。';
         return false;
     }
     if ($this->checkControlCodeNothing($this->bccField)) {
         $this->errorMessage = '宛先の情報にコントロールコードが含まれています。';
         return false;
     }
     $headerField = "X-Mailer: Open Mail Envrionment for PHP on INTER-Mediator(http://inter-mediator.org)\n";
     $headerField .= "Content-Type: text/plain; charset={$this->mailEncoding}\n";
     if ($this->fromField != '') {
         $headerField .= "From: {$this->fromField}\n";
     }
     if ($this->ccField != '') {
         $headerField .= "Cc: {$this->ccField}\n";
     }
     if ($this->bccField != '') {
         $headerField .= "Bcc: {$this->bccField}\n";
     }
     if ($this->isSetCurrentDateToHead) {
         $formatString = 'r';
         //"D, d M Y H:i:s O (T)";
         $headerField .= "Date: " . date($formatString) . "\n";
         // Mon, 10 Feb 2014 19:36:36 +0900 (JST)
     }
     if ($this->extHeaders != '') {
         $headerField .= $this->extHeaders;
     }
     $bodyString = $this->devideWithLimitingWidth($this->body);
     if ($this->mailEncoding != 'UTF-8') {
         $bodyString = mb_convert_encoding($bodyString, $this->mailEncoding);
     }
     if ($this->smtpInfo === null) {
         if ($this->isUseSendmailParam) {
             $resultMail = mail(rtrim($this->header_base64_encode($this->toField, False)), rtrim($this->header_base64_encode($this->subject, true)), $bodyString, $this->header_base64_encode($headerField, True), $this->sendmailParam);
         } else {
             $resultMail = mail(rtrim($this->header_base64_encode($this->toField, False)), rtrim($this->header_base64_encode($this->subject, true)), $bodyString, $this->header_base64_encode($headerField, True));
         }
     } else {
         if ($this->senderAddress != null) {
             $this->smtpInfo["from"] = $this->senderAddress;
         }
         $smtp = new QdSmtp($this->smtpInfo);
         $resultMail = $smtp->mail($this->unifyCRLF(rtrim($this->header_base64_encode($this->toField, False))), $this->unifyCRLF(rtrim($this->header_base64_encode($this->subject, true))), $this->unifyCRLF($bodyString), $this->unifyCRLF($this->header_base64_encode($headerField, True)));
     }
     return $resultMail;
 }
Example #2
0
    exit;
} elseif ($page === 'finish') {
    // -------------------------------------------------------
    // メール送信
    // -------------------------------------------------------
    // ライブラリ読み込み
    require_once DIR_LIB . '/qdmail.php';
    require_once DIR_LIB . '/qdsmtp.php';
    // Qdmailの設定
    $mail = new Qdmail();
    $mail->errorDisplay(false);
    $mail->errorlogPath(DIR_LOGS . '/');
    $mail->errorlogLevel(3);
    $mail->errorlogFilename('qdmail_error.log');
    // Qdsmtpの設定
    $smtp = new QdSmtp();
    $smtp->pop3TimeFilename(DIR_TEMP . '/qdsmtp.time');
    $mail->setSmtpObject($smtp);
    // 宛先
    $to_email = TO_EMAIL;
    // 件名
    $to_subject = TO_SUBJECT;
    // メール本文
    $body = $tmpl->fetch(MAIL_BODY);
    $body = hd($body);
    // メール送信元
    if (isset($_POST[AUTO_REPLY_EMAIL]) && !empty($_POST[AUTO_REPLY_EMAIL])) {
        $from_email = $_POST[AUTO_REPLY_EMAIL];
    } else {
        $from_email = $to_email;
    }