public function handleException($e) { $this->_exception = $e; $mail = new Qdmail(); $mail->smtp($this->useSmtp); $mail->smtpServer($this->smtpParams); $mail->to($this->exceptionRecipients); $mail->subject($this->subjectPrefix . '[' . date('Ymd H:i:s') . '][' . $this->_getSeverityAsString() . '][' . $this->_getUrl() . '] ' . $this->_exception->getMessage()); $mail->text($this->_getText()); $mail->from($this->exceptionFrom); $mail->send(); }
function mailsender($to, $subject, $body, $fromname, $fromaddress) { //SMTP送信 $mail = new Qdmail(); $mail->smtp(true); $param = array('host' => 'tls://*********', 'port' => 465, 'from' => '*********@*********', 'protocol' => 'SMTP_AUTH', 'user' => '*********@*********', 'pass' => '*********'); $mail->smtpServer($param); $mail->to($to); $mail->subject($subject); $mail->from($fromaddress, $fromname); $mail->text($body); $return_flag = $mail->send(); return $return_flag; }
// BCCメールアドレスの設定がある場合 if (BCC_EMAIL !== '') { $mail->bcc(BCC_EMAIL); } // 添付ファイル機能を利用する場合 if (FILE) { foreach ($files as $file) { $attach[] = array('PATH' => DIR_TEMP . '/' . $file['tmp_name'], 'NAME' => $file['name']); } if (isset($attach)) { $mail->attach($attach); } } // 外部SMTPを利用する場合 if (SMTP) { $mail->smtp(true); $mail->smtpServer(array('host' => SMTP_HOST, 'port' => SMTP_PORT, 'protocol' => SMTP_PROTOCOL, 'user' => SMTP_USER, 'pass' => SMTP_PASSWORD, 'from' => $from_email)); } // メール送信 $result = $mail->send(); // 送信できなかった場合 if (!$result) { // エラーメッセージ $global_error_flag = true; $global_error[] = ERROR_FAILURE_SEND_MAIL; // ログの内容 $suffix = 'sendmail'; $data = ERROR_FAILURE_SEND_MAIL . "\n\n" . "--\n\n" . "【宛先】\n" . "{$to_email}\n\n" . "【件名】\n" . "{$to_subject}\n\n" . "【本文】\n" . "{$body}"; // 添付ファイルがある場合 if (FILE) { foreach ($files as $key => $file) {
//ヒアドキュメントを使用 $mailBody = <<<EOT 本文本文本文本文本文本文本文本文本文 本文本文本文本文本文本文本文本文本文 本文本文本文本文本文本文本文本文本文 EOT; $mail = new Qdmail(); $mail->errorDisplay(FALSE); $mail->smtpObject()->error_display = FALSE; $from = "*****@*****.**"; //宛先 $to = "*****@*****.**"; //送信元 $mail->from($from, "Webマスター"); //宛先名 $mail->to($to, "管理者"); //送信元名 $mail->subject("お問合せ"); //件名 $mail->text($mailBody); //本文 //データを格納する $param = array("host" => "ssl://smtp.gmail.com", "port" => 465, "from" => "*****@*****.**", "protocol" => "SMTP_AUTH", "user" => "*****@*****.**", "pass" => "rrrr0611"); $mail->smtp(TRUE); $mail->smtpServer($param); $flag = $mail->send(); if ($flag == TRUE) { print "送信成功"; } else { print "送信失敗"; }
function dl_sendmail($email, $filename, $title) { global $smtp_auth, $smtp_server, $google_apps, $google_apps_domain; $qm = get_qm(); $xsubject = $title == '' ? $qm->replace('plg_dlbutton.subject', '') : $title; $xmsg = $qm->replace('plg_dlbutton.mail_body', $filename); $xheader = "From: " . $email . "\n"; $xparameter = "-f" . $email; //Mail send setting if ($google_apps && preg_match('/.*' . $google_apps_domain . '$/', $email)) { $mail = new Qdmail(); $mail->smtp(true); $param = array('host' => 'ASPMX.L.GOOGLE.com', 'port' => 25, 'from' => $email, 'protocol' => 'SMTP', 'user' => 'root@' . $google_apps_domain, 'pass' => $passwd); $mail->smtpServer($param); $mail->to($email); $mail->subject($xsubject); $mail->from($email); $mail->text($xmsg); $return_flag = $mail->send(); } else { $mail = new SimpleMail(); $mail->set_params('', $email); $mail->set_to('', $email); $mail->set_subject($xsubject); $mail->send($xmsg); } }