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; } }
/** * Overrides parent's method to load qdsmtp.php from app/vendors * and share the log locations with Qdmail(er). * */ function &smtpObject() { App::import('Vendor', 'qdsmtp'); $smtp =& parent::smtpObject(); $smtp->logFilename($this->logPath() . $smtp->name . '.log'); $smtp->errorlogFilename($this->errorlogPath() . $smtp->name . '_error.log'); $smtp->error_display = $this->errorDisplay(); return $smtp; }