private function __send($to, $subject, $template = 'default') { $qdmail = new QdmailComponent(null); $qdmail->startup($this->controller); config('mail'); $params = MAIL_CONFIG::$smtp; $qdmail->smtp(true); $qdmail->smtpServer($params); //$qdmail->debug(2); $qdmail->to($to); $qdmail->from($params['from']); $qdmail->subject($subject); $this->controller->view = 'View'; $qdmail->cakeText(null, $template, null, null, 'iso-2022-jp'); return $qdmail->send(); }
protected function sendmail($mail_setting, $mail_content) { // QdmailとDebugKitの共存対応 $this->view = "View"; Configure::write("debug", 0); mb_language("Japanese"); $param = array('host' => Configure::read('Config.mail_smtp'), 'port' => Configure::read('Config.mail_smtp_port'), 'from' => Configure::read('Config.mail_from'), 'protocol' => Configure::read('Config.mail_protocol'), 'user' => Configure::read('Config.mail_smtp_user'), 'pass' => Configure::read('Config.mail_smtp_password'), 'pop_host' => Configure::read('Config.mail_pop_host'), 'pop_user' => Configure::read('Config.mail_pop_username'), 'pop_pass' => Configure::read('Config.mail_pop_password')); $to = $mail_setting['mail_to']; $to_array = explode(',', $to); $name_array = array(); for ($i = 0; $i < count($to_array); $i++) { $name_array[] = ''; } $this->Qdmail->to($to_array, $name_array); $this->Qdmail->subject($mail_setting['mail_subject']); $this->Qdmail->from(Configure::read('Config.mail_from'), ''); $this->Qdmail->smtp(true); $this->Qdmail->smtpServer($param); $this->Qdmail->logLevel(3); $this->Qdmail->errorlogLevel(3); $this->Qdmail->errorDisplay(false); $this->Qdmail->smtpObject()->error_display = false; $this->Qdmail->smtpLoglevelLink(true); $this->Qdmail->logPath(LOGS); $this->Qdmail->logFilename("mail.log"); $this->Qdmail->errorlogPath(LOGS); $this->Qdmail->errorlogFilename("error_mail.log"); //メールの表示情報を渡す $this->Qdmail->cakeText($mail_content, $mail_setting['mail_template']); if ($this->Qdmail->send() != false) { $this->log(__('Sending email is successfully finished.', true), LOG_INFO); return TRUE; } else { $this->log(__('Sending email is failed.', true), LOG_INFO); return FALSE; } }