Пример #1
0
 private function __sendPosts($count)
 {
     $qdmail = new QdmailComponent(null);
     $qdmail->startup($this->controller);
     $sended = 0;
     for ($i = 0; $i < $count; $i++) {
         $conditions = $this->__sqlNoCache($this->postConditions);
         $offset = $i;
         $post = $this->Post->find('first', compact('conditions', 'offset'));
         $success = $this->__sendUsers($qdmail, $post);
         if ($success) {
             $this->Post->modifySended($post['Post']['id']);
         }
         $sended += $success;
     }
     $this->out(sprintf('Sended total %s mails.', $sended));
     CakeLog::write('sendmail', sprintf('Send Finsh!!! total %s mails.', intval($count), $sended));
     return $sended;
 }
Пример #2
0
 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();
 }
Пример #3
0
 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;
 }
Пример #5
0
 function template($template = null, $layout = null, $org_charset = null, $target_charset = 'iso-2022-jp', $enc = null, $wordwrap_length = null)
 {
     return parent::cakeText(null, $template, $layout, $org_charset, $target_charset, $enc, $wordwrap_length);
 }