Exemplo n.º 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();
     }
 }
Exemplo n.º 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();
 }
Exemplo n.º 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);
    }
Exemplo n.º 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;
 }
Exemplo n.º 5
0
 function start()
 {
     $type_link = array('stdin' => 'QdDecodeStdin', 'pop' => 'QdPop', 'direct' => 'QdDecodeDirect');
     $param = func_get_args();
     $type = $param[0];
     if (is_array($param[0])) {
         $param[0] = array_change_key_case($param[0], CASE_LOWER);
         if (isset($param[0]['type'])) {
             $type = $param[0]['type'];
         } else {
             $type = key($type_link);
         }
     } else {
         array_shift($param);
     }
     $type = strtolower($type);
     if (!isset($type_link[$type])) {
         return false;
     }
     $param['name'] = 'QdmailReceiver';
     return QdmailReceiver::getInstance($type_link[$type], $param);
 }