예제 #1
0
 public function execute()
 {
     $receiver = QdmailReceiver::start('stdin');
     $receiver->getMail();
     $email = $receiver->header(array('from', 'mail'));
     if ($email) {
         $this->User->begin();
         if ($user = $this->User->register($email)) {
             $this->controller->set(compact('user'));
             if ($this->__send($user['User']['email'], __('Confirm Register', true), 'confirm_register')) {
                 $this->User->commit();
                 return;
             }
         }
         $this->User->rollback();
     }
 }
예제 #2
0
 public function execute()
 {
     config('mail');
     $params = MAIL_CONFIG::$pop;
     $receiver = QdmailReceiver::start('pop', $params);
     $count = $receiver->count();
     if (!$count) {
         return;
     }
     for ($i = 1; $i <= $count; $i++) {
         $body = $receiver->text();
         $this->__countUpError($body);
         $receiver->delete();
         $receiver->next();
     }
     $receiver->done();
     $this->__deleteUser();
 }
예제 #3
0
    /**
     */
    public function testGenerate()
    {
        $mailsrc = <<<_END_
From - Mon Mar 04 12:48:45 2013
Date: Mon, 04 Mar 2013 12:48:05 +0900
From: Sample From <*****@*****.**>
To: SampleTo <*****@*****.**>
Subject: Sample subject
Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: 7bit

Hello.
This is sample mail for test.

--
Signature
_END_;
        $receiver = QdmailReceiver::start('direct', $mailsrc);
        $this->assertNotNull($receiver);
        $this->assertInstanceOf('QdDecodeDirect', $receiver);
    }
예제 #4
0
 function decode()
 {
     if (!class_exists('QdmailReceiver')) {
         include 'qd_mail_receiver.php';
     }
     $num_boundary = strpos(strtolower($this->template), 'boundary');
     $num_crlf = strpos($this->template, "\r\n\r\n");
     $template = $this->template;
     while (false !== $num_boundary && false !== $num_crlf && $num_boundary > $num_crlf) {
         $template = substr($template, $num_crlf + 4);
         $num_crlf = strpos($template, "\r\n\r\n");
         $num_boundary = strpos(strtolower($template), 'boundary');
     }
     $receiver = QdmailReceiver::start('direct', $template);
     $this->data['HTML'] = $receiver->bodyAutoSelect();
     if (false === $this->data['HTML']) {
         $this->data['HTML'] = '';
     }
     $attach = $receiver->attach();
     foreach ($attach as $att) {
         if (isset($att['content-id'])) {
             $cid = rtrim($att['content-id'], '>');
             $cid = ltrim($cid, '<');
         } elseif (isset($att['content_id'])) {
             $cid = rtrim($att['content_id'], '>');
             $cid = ltrim($cid, '<');
         } else {
             $cid = null;
         }
         $this->data['ATTACH'][] = array('PATH' => $att['filename_safe'], 'NAME' => $att['filename_safe'], 'CONTENT-TYPE' => $att['mimetype'], 'CONTENT-ID' => $cid, '_CHARSET' => null, '_ORG_CHARSET' => null, 'DIRECT' => $att['value'], 'BARE' => false);
     }
     return true;
 }
예제 #5
0
 function qd_receive_mail($cmd, $param = null, $charset = null)
 {
     static $receive = array();
     static $error = array();
     static $method = array('all' => 'all', 'next' => 'next', 'prev' => 'prev', 'count' => 'count', 'pointer' => 'pointer', 'done' => 'done', 'timeout' => 'timeout', 'debug' => 'debug', 'attach' => 'attach', 'eof' => 'eof', 'bodyall' => 'body', 'body' => 'bodyAutoSelect', 'text' => 'text', 'html' => 'html', 'ishtml' => 'isHtml', 'header' => 'header', 'head' => 'header', 'deleteuid' => 'deleteUid', 'deluid' => 'deleteUid', 'pophigh' => 'popHigh', 'delete' => 'delete', 'del' => 'delete', 'listheader' => 'listHeader');
     $cmd = strtolower($cmd);
     if ('pop' == $cmd) {
         $receive[0] = QdmailReceiver::start('pop', $param, $charset);
     }
     if ('stdin' == $cmd) {
         $receive[0] = QdmailReceiver::start('stdin', $param, $param);
     }
     if ('direct' == $cmd) {
         $receive[0] = QdmailReceiver::start('direct', $param, $charset);
     }
     if (!is_object($receive[0])) {
         return false;
     }
     if (isset($charset)) {
         $receive[0]->charser($charset);
     }
     if ('error' == $cmd) {
         return $error;
     }
     if ('start' == $cmd) {
         return true;
     }
     if (!isset($method[$cmd]) || !method_exists($receive[0], $method[$cmd])) {
         $error[] = 'Call no decleared Method \'' . $cmd . '\'';
         return false;
     }
     return $receive[0]->{$method[$cmd]}($param);
 }