/** * getInstanceメソッド * * このクラスのオブジェクトを生成する。 * 既に生成されていたら、前回と同じものを返す。 * * @return object $instance */ public static function getInstance() { if (!self::$instance) { $className = __CLASS__; self::$instance = new $className(); } return self::$instance; }
/** * 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; } // $site: config.php内で宣言 global $site; // http通信 //送信用にエンコード $sendSubject = $mailElements["subject"]; $sendTextBody = htmlspecialchars_decode($mailElements["text_body"], ENT_QUOTES); //$sendHtmlBody = base64_encode($mailElements["html_body"]); // 送信項目の設定 $postData["to"] = $site["default_info"]; $postData["rtn_path"] = $mailElements["return_path"] ? $mailElements["return_path"] : $site["site_account"][$site["default_info"]]["return_path"]; $postData["from"] = "root@" . $site["site_account"][$site["default_info"]]["domain"]; $postData["from_nm"] = $site["site_account"][$site["default_info"]]["name"]; $postData["sbj"] = $sendSubject; $postData["body"] = $sendTextBody; $postData["html"] = $mailElements["html_body"]; $postData["sec"] = $sec; // リメール用インスタンス生成 $operationMailSendMagicDeliveryOBJ = new SendMagicDelivery(); // SMTPホスト設定(通常) $operationMailSendMagicDeliveryOBJ->setSendMailServerIp($this->_mail_server); // SMTP接続開始 if (!$operationMailSendMagicDeliveryOBJ->openSmtpConnect()) { return false; } $sendResult = ""; $sendMailData = $postData; $smtpSendResult = true; if ($sendMailData) { // リメール送信 if (!$operationMailSendMagicDeliveryOBJ->sendMagicDelivery($sendMailData)) { $smtpSendResult = false; } } else { $smtpSendResult = false; } // SMTP切断 $operationMailSendMagicDeliveryOBJ->closeSmtpConnect(); return $smtpSendResult; }