/** * mailToメソッド * * メール送信実行 * * @param string $mailAddress 送信するメアド * @param array $$mailElements 送信する要素 * [from_address]:メール送信元アドレス * [from_name] :メール送信元名(任意) * [return_path] :リターンアドレス(任意) * [subject] :メールタイトル * [text_body] :メール本文(テキスト) * [html_body] :メール本文(HTML)(任意) * @return 送信成功:True 送信失敗:False */ public function mailTo($mailElements, $sec = 0, $imageData = null, $imageType = null) { $AdmMailMagazineOBJ = AdmMailMagazine::getInstance(); //return $AdmMailMagazineOBJ->mailTo($mailElements, $sec, $imageData, $imageType); $sendMailData = $AdmMailMagazineOBJ->smtpMailTo($mailElements, $sec, $imageData, $imageType); // リメール用インスタンス生成 $contactComSendMagicDeliveryOBJ = new ComSendMagicDelivery(); // SMTPホスト設定(SendMagic) $contactComSendMagicDeliveryOBJ->setSendMailServerIp($this->_configOBJ->common_config->smtp_mail_server_ip->sendMagic); // SMTP接続開始 if (!$contactComSendMagicDeliveryOBJ->openSmtpConnect()) { return false; } $smtpSendResult = true; if ($sendMailData) { // リメール送信 if (!$contactComSendMagicDeliveryOBJ->sendMagicDelivery($sendMailData)) { $smtpSendResult = false; } } else { $smtpSendResult = false; } // SMTP切断 $contactComSendMagicDeliveryOBJ->closeSmtpConnect(); return $smtpSendResult; }
$sendCnt["sendPcCnt"] = 0; $sendCnt["notSendMbCnt"] = 0; $sendCnt["sendMbCnt"] = 0; $sendCnt["notSendNoRegCnt"] = 0; $fromAddressAry = explode("@", $listValue["from_address"]); $changeFromAddressFlag = FALSE; if ($_config["define"]["MAIL_DOMAIN"] == $fromAddressAry[1]) { $changeFromAddressFlag = TRUE; } $mailDomainArray = $_config["define"]["SEND_MAIL_DOMAIN"]; end($mailDomainArray); //最後の要素 $lastMailDomainKey = key($mailDomainArray); //最後の要素のキー // SMTP接続開始 if (!$normalComSendMagicDeliveryOBJ->openSmtpConnect() || !$reverseComSendMagicDeliveryOBJ->openSmtpConnect()) { // デバッグメール $debugMail = ""; $debugMail["subject"] = "定期メルマガ送信エラー"; $debugMail["text_body"][] = "file:" . __FILE__; $debugMail["text_body"][] = "line:" . __LINE__; $debugMail["text_body"][] = "mailmagine_regular_id:" . $listValue["id"]; $debugMail["text_body"] = implode("\n", $debugMail["text_body"]); // システムにエラーメール $SendMailOBJ->debugMailTo($debugMail); } // 送信数 $sendUserCount = 0; while (list($key, $val) = each($userList)) { // 送信数が1000件でSMTP切断→再接続 if ($sendUserCount != 0 && $sendUserCount % 1000 == 0) {
/** * operationMailToメソッド(SMTP) * * 運営へメール送信実行 * * @param array $mailElements 送信する要素 * [return_path] :リターンアドレス(任意) * [subject] :メールタイトル * [text_body] :メール本文(テキスト) * [html_body] :メール本文(HTML)(任意) * @return 送信成功:True 送信失敗:False */ public function operationMailTo($mailElements, $sec = 0) { if (!isset($mailElements)) { return FALSE; } // http通信 //送信用にエンコード $sendSubject = $mailElements["subject"]; $sendTextBody = htmlspecialchars_decode($mailElements["text_body"], ENT_QUOTES); //$sendHtmlBody = base64_encode($mailElements["html_body"]); // 送信項目の設定 $postdata["to"] = self::OPERATION_MAIL_ACCOUNT . $this->_configOBJ->define->MAIL_DOMAIN; $postdata["rtn_path"] = $mailElements["return_path"] ? $mailElements["return_path"] : self::RETURN_PATH . $this->_configOBJ->define->MAIL_DOMAIN; $postdata["from"] = "root@" . $this->_configOBJ->define->MAIL_DOMAIN; $postdata["from_nm"] = $this->_configOBJ->define->SITE_NAME; $postdata["sbj"] = $sendSubject; $postdata["body"] = $sendTextBody; $postdata["html"] = $mailElements["html_body"]; $postdata["sec"] = $sec; // リメール用インスタンス生成 $operationMailComSendMagicDeliveryOBJ = new ComSendMagicDelivery(); // SMTPホスト設定(SendMagic) $operationMailComSendMagicDeliveryOBJ->setSendMailServerIp($this->_configOBJ->common_config->smtp_mail_server_ip->sendMagic); // SMTP接続開始 if (!$operationMailComSendMagicDeliveryOBJ->openSmtpConnect()) { return false; } // 送信メールデータ生成 $sendMailData = $postdata; $smtpSendResult = true; if ($sendMailData) { // リメール送信 if (!$operationMailComSendMagicDeliveryOBJ->sendMagicDelivery($sendMailData)) { $smtpSendResult = false; } } else { $smtpSendResult = false; } // SMTP切断 $operationMailComSendMagicDeliveryOBJ->closeSmtpConnect(); return $smtpSendResult; }