当前位置: 首页>>代码示例>>PHP>>正文


PHP imap_last_error函数代码示例

本文整理汇总了PHP中imap_last_error函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_last_error函数的具体用法?PHP imap_last_error怎么用?PHP imap_last_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了imap_last_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getdata

 function getdata($host, $login, $password, $savedirpath)
 {
     $mbox = imap_open($host, $login, $password) or die("can't connect: " . imap_last_error());
     $message = array();
     $message["attachment"]["type"][0] = "text";
     $message["attachment"]["type"][1] = "multipart";
     $message["attachment"]["type"][2] = "message";
     $message["attachment"]["type"][3] = "application";
     $message["attachment"]["type"][4] = "audio";
     $message["attachment"]["type"][5] = "image";
     $message["attachment"]["type"][6] = "video";
     $message["attachment"]["type"][7] = "other";
     $buzon_destino = "cfdi";
     echo imap_createmailbox($mbox, imap_utf7_encode("{$buzon_destino}"));
     echo imap_num_msg($mbox);
     for ($jk = 1; $jk <= imap_num_msg($mbox); $jk++) {
         $structure = imap_fetchstructure($mbox, $jk);
         $parts = $structure->parts;
         $fpos = 2;
         for ($i = 1; $i < count($parts); $i++) {
             $message["pid"][$i] = $i;
             $part = $parts[$i];
             if (strtolower($part->disposition) == "attachment") {
                 $message["type"][$i] = $message["attachment"]["type"][$part->type] . "/" . strtolower($part->subtype);
                 $message["subtype"][$i] = strtolower($part->subtype);
                 $ext = $part->subtype;
                 $params = $part->dparameters;
                 $filename = $part->dparameters[0]->value;
                 if (!($ext == 'xml' or $ext == 'XML' or $ext == 'PDF' or $ext == 'pdf')) {
                     continue;
                 }
                 $mege = "";
                 $data = "";
                 $mege = imap_fetchbody($mbox, $jk, $fpos);
                 $data = $this->getdecodevalue($mege, $part->type);
                 $fp = fopen($filename, 'w');
                 fputs($fp, $data);
                 fclose($fp);
                 $fpos += 1;
                 /* Se mueve el archiv descargado al directorio de recibidos */
                 //                    rename($filename, $savedirpath.$filename);
                 //                    printf("\nSe movio el archivo $filename");
             }
         }
         $result = imap_fetch_overview($mbox, $jk);
         echo $result[0]->from;
         //            imap_mail_move($mbox, $jk, $buzon_destino);
         //imap_delete tags a message for deletion
         //    imap_delete($mbox,$jk);
     }
     // imap_expunge deletes all tagged messages
     //                    imap_expunge($mbox);
     imap_close($mbox);
 }
开发者ID:njmube,项目名称:CSDOCSCFDI,代码行数:54,代码来源:CorreoGetAdjuntos.class.php

示例2: fetchStructure

 public function fetchStructure()
 {
     $structure = imap_fetchstructure($this->stream, $this->number);
     if (FALSE === $structure) {
         throw new Exception('FetchStructure failed: ' . imap_last_error());
     }
     return $structure;
 }
开发者ID:kamaroly,项目名称:kigalilifeapp,代码行数:8,代码来源:IMAPMessage.php

示例3: connect

 public function connect()
 {
     $this->stream = imap_open('{' . $this->hostname . $this->port . '/' . $this->driver . $this->ssl . $this->novalidate . '}INBOX', $this->username, $this->password) or die('Cannot connect to Server: ' . imap_last_error());
     if ($this->stream) {
         $this->isConnect = true;
     }
 }
开发者ID:nahidz,项目名称:imapx,代码行数:7,代码来源:Imapx.php

示例4: initImapStream

	protected function initImapStream() {
		$imapStream = @imap_open($this->imapPath, $this->imapLogin, $this->imapPassword, $this->imapOptions, $this->imapRetriesNum, $this->imapParams);
		if(!$imapStream) {
			throw new Exception('Connection error: ' . imap_last_error());
		}
		return $imapStream;
	}
开发者ID:hoanghd,项目名称:tools,代码行数:7,代码来源:Mailbox.php

示例5: authenticate_imap

function authenticate_imap($user, $pass)
{
    global $LOGIN_IMAP_CONNECTION;
    global $AUTH_ERR;
    if (hostname() == 'tauceti') {
        $server = '{localhost:143/imap/tls/novalidate-cert}';
    } elseif (hostname() == 'Daneel.dynamic.wondermill.com') {
        $server = '{localhost:143/imap/notls}';
    } else {
        $server = '{localhost:143/imap/tls/novalidate-cert}';
    }
    if ($c = imap_open($server, $user, $pass, OP_HALFOPEN)) {
        if (LOGIN_IMAP_KEEPCONNECTION) {
            $LOGIN_IMAP_CONNECTION =& $c;
        } else {
            //debug('Closing connection');
            imap_close($c);
        }
        return AUTH_SUCCESS;
    } else {
        if ($AUTH_ERR = imap_last_error()) {
            return AUTH_SERVFAIL;
        } else {
            return AUTH_DENY;
        }
    }
}
开发者ID:nbtscommunity,项目名称:phpfnlib,代码行数:27,代码来源:authenticate_imap.php

示例6: getMail

 /**
  * Gets the mail from the inbox
  * Reads all the messages there, and adds posts based on them. Then it deletes the entire mailbox.
  */
 function getMail()
 {
     $config = Config::current();
     if (time() - 60 * $config->emailblog_minutes >= $config->emailblog_mail_checked) {
         $hostname = '{' . $config->emailblog_server . '}INBOX';
         # this isn't working well on localhost
         $username = $config->emailblog_address;
         $password = $config->emailblog_pass;
         $subjpass = $config->emailblog_subjpass;
         $inbox = imap_open($hostname, $username, $password) or exit("Cannot connect to Gmail: " . imap_last_error());
         $emails = imap_search($inbox, 'SUBJECT "' . $subjpass . '"');
         if ($emails) {
             rsort($emails);
             foreach ($emails as $email_number) {
                 $message = imap_body($inbox, $email_number);
                 $overview = imap_headerinfo($inbox, $email_number);
                 imap_delete($inbox, $email_number);
                 $title = htmlspecialchars($overview->Subject);
                 $title = preg_replace($subjpass, "", $title);
                 $clean = strtolower($title);
                 $body = htmlspecialchars($message);
                 # The subject of the email is used as the post title
                 # the content of the email is used as the body
                 # not sure about compatibility with images or audio feathers
                 Post::add(array("title" => $title, "body" => $message), $clean, Post::check_url($clean), "text");
             }
         }
         # close the connection
         imap_close($inbox, CL_EXPUNGE);
         $config->set("emailblog_mail_checked", time());
     }
 }
开发者ID:betsyzhang,项目名称:chyrp,代码行数:36,代码来源:emailblog.php

示例7: moveMailToFolder

 /**
  * @param $mail_id
  * @param string $folder
  */
 public function moveMailToFolder($mail_id, $folder = 'INBOX/Junk')
 {
     $imapresult = imap_mail_move($this->getImapStream(), $mail_id, $folder, CP_UID);
     if (!$imapresult) {
         echo imap_last_error();
     }
 }
开发者ID:pnoreck,项目名称:mailscanner,代码行数:11,代码来源:Mailbox.php

示例8: open

 function open($hostname, $username, $password)
 {
     $this->con = imap_open($hostname, $username, $password);
     if (!$this->con) {
         throw new \Exception("Unable to open connection to: " . $hostname . ' error: ' . imap_last_error());
     }
 }
开发者ID:splitice,项目名称:radical-mail,代码行数:7,代码来源:IMAP.php

示例9: emailDeliverFailBySubject

 public static function emailDeliverFailBySubject($subject)
 {
     $mailcnf = "outlook.office365.com:993/imap/ssl/novalidate-cert";
     $username = MAILACCOUNT;
     $pw = MAILPASSWORD;
     $conn_str = "{" . $mailcnf . "}INBOX";
     $inbox = imap_open($conn_str, $username, $pw) or die('Cannot connect to mail: ' . imap_last_error());
     /* grab emails */
     $emails = imap_search($inbox, 'SUBJECT "Undeliverable: ' . $subject . '"');
     $failedInfo = [];
     /* if emails are returned, cycle through each... */
     if ($emails) {
         /* for every email... */
         foreach ($emails as $email_number) {
             /* get information specific to this email */
             $body = imap_fetchbody($inbox, $email_number, 2);
             $list = split('; ', $body);
             $sender = $list[2];
             $sender_email = explode("\n", $sender)[0];
             array_push($failedInfo, trim($sender_email));
         }
     }
     /* close the connection */
     imap_close($inbox);
     return $failedInfo;
 }
开发者ID:aanyun,项目名称:PHP-Sample-Code,代码行数:26,代码来源:EmailController.php

示例10: connect

 protected function connect()
 {
     $this->mbox = @$this->imap_open($this->imapPath, $this->login, $this->password);
     if (!$this->mbox) {
         throw new ImapMailboxException('Connection error: ' . imap_last_error());
     }
 }
开发者ID:lexdk,项目名称:Orangescrum_Installation,代码行数:7,代码来源:ImapMailbox.php

示例11: connect

 public function connect()
 {
     if (empty($this->_connectionString)) {
         $this->_connectionType = $this->_config['type'];
         switch ($this->_config['type']) {
             case 'imap':
                 $this->_connectionString = sprintf('{%s:%s%s%s}%s', $this->_config['server'], $this->_config['port'], '/' . $this->_config['type'], @$this->_config['ssl'] ? '/ssl' : '', !empty($this->_config['mailbox']) ? $this->_config['mailbox'] : '');
                 break;
             case 'pop3':
                 $this->_connectionString = sprintf('{%s:%s/pop3%s}%s', $this->_config['server'], $this->_config['port'], @$this->_config['ssl'] ? '/ssl' : '', !empty($this->_config['mailbox']) ? $this->_config['mailbox'] : '');
                 break;
         }
     }
     try {
         $this->thread = null;
         $retries = 0;
         while ($retries++ < $this->_config['retry'] && !$this->thread) {
             $this->Stream = imap_open($this->_connectionString, $this->_config['username'], $this->_config['password']);
             $this->thread = @imap_thread($this->Stream);
         }
         if (!$this->thread) {
             throw new \Exception('Unable to get imap_thread');
         }
         if (!$this->Stream) {
             throw new \Exception('Connection error: ' . imap_last_error());
         }
     } catch (Exception $e) {
         debug($e->getMessage);
     }
     return $this->_isConnected = true;
 }
开发者ID:ch0c4,项目名称:cake-mailer,代码行数:31,代码来源:Connection.php

示例12: index

 public function index()
 {
     $this->template = "";
     $this->auto_render = FALSE;
     // First is IMAP PHP Library Installed?
     $modules = new Modulecheck();
     if ($modules->isLoaded('imap')) {
         // If SSL Enabled
         $ssl = Kohana::config('settings.email_ssl') == true ? "/ssl" : "";
         // Do not validate certificates (TLS/SSL server)
         //$novalidate = strtolower(Kohana::config('settings.email_servertype')) == "imap" ? "/novalidate-cert" : "";
         $novalidate = "/novalidate-cert";
         // If POP3 Disable TLS
         $notls = strtolower(Kohana::config('settings.email_servertype')) == "pop3" ? "/notls" : "";
         $service = "{" . Kohana::config('settings.email_host') . ":" . Kohana::config('settings.email_port') . "/" . Kohana::config('settings.email_servertype') . $notls . $ssl . $novalidate . "}";
         // Connected!
         if (@imap_open($service, Kohana::config('settings.email_username'), Kohana::config('settings.email_password'), 0, 1)) {
             echo json_encode(array("status" => "success", "message" => Kohana::lang('ui_main.success')));
         } else {
             echo json_encode(array("status" => "error", "message" => Kohana::lang('ui_main.error') . " - " . imap_last_error()));
         }
     } else {
         echo json_encode(array("status" => "error", "message" => Kohana::lang('ui_main.error') . " - " . Kohana::lang('ui_admin.error_imap')));
     }
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:25,代码来源:test_email.php

示例13: getEmails

 /**
  * @return array
  * @throws Exception
  */
 public function getEmails()
 {
     $emails = imap_search($this->imap, 'ALL', SE_UID);
     if ($emails === false) {
         throw new Exception('Cannot get emails: ' . imap_last_error());
     }
     return $emails;
 }
开发者ID:cornernote,项目名称:mrphp,代码行数:12,代码来源:MrEmailReader.php

示例14: moveMail

 public function moveMail($mailId)
 {
     $imapresult = imap_mail_move($this->getImapStream(), $mailId, 'INBOX.Archive') && $this->expungeDeletedMails();
     if ($imapresult == false) {
         error_log(imap_last_error());
     }
     return $imapresult;
 }
开发者ID:escobar022,项目名称:wp_mailman,代码行数:8,代码来源:receivemail.class.php

示例15: initImapStream

 protected function initImapStream()
 {
     $imapStream = @imap_open($this->imapPath, $this->login, $this->password);
     if (!$imapStream) {
         throw new ImapMailboxException('Connection error: ' . imap_last_error());
     }
     return $imapStream;
 }
开发者ID:adamwojtkiewicz,项目名称:php-imap,代码行数:8,代码来源:ImapMailbox.php


注:本文中的imap_last_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。