示例#1
0
 $mail->from($from_email);
 // CCメールアドレスの設定がある場合
 if (CC_EMAIL !== '') {
     $mail->cc(CC_EMAIL);
 }
 // 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;
     // ログの内容
示例#2
0
 /**
  *  メールを送信する
  */
 protected function mail_send($mail_address_to, $mail_subject, $mail_content, $mail_address_from = '', $mail_attach_path = '')
 {
     $this->load->library('qdmail');
     $this->load->helper('email');
     if (!valid_email("{$mail_address_to}")) {
         return FALSE;
     }
     if (!$mail_address_from) {
         $mail_address_from = MAIL_ADDRESS_FROM;
     }
     $mail = new Qdmail();
     $mail->to("{$mail_address_to}");
     $mail->subject("{$mail_subject}");
     $mail->text("{$mail_content}");
     $mail->from("{$mail_address_from}");
     if ($mail_attach_path and file_exists($mail_attach_path)) {
         $mail->attach($mail_attach_path);
     }
     $mail->send();
     //qd_send_mail('text',$mail_address_to,"$title",$mail_content,"$mail_address_from");
     return TRUE;
 }