• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP imap_last_error函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: _init_imap_stream

 protected function _init_imap_stream()
 {
     $imap_stream = @imap_open($this->_full_imap_path(), $this->imap_user, $this->imap_pass);
     if (!$imap_stream) {
         throw new Exception('Connection error: ' . imap_last_error());
     }
     return $imap_stream;
 }
开发者ID:nguyenanhnhan,项目名称:CI_Imap,代码行数:8,代码来源:MY_Email.php


示例17: connectionopen

 private function connectionopen($config)
 {
     $mbox = @imap_open('{' . $config['server'] . ':' . $config['port'] . '/' . $config['conntyp'] . '/' . $config['extras'] . '}' . $config['ordner'], $config['username'], $config['password']);
     if (!$mbox) {
         $mbox = imap_last_error();
         $this->setfehler($mbox);
     }
     return $mbox;
 }
开发者ID:aalmenar,项目名称:validatexarf,代码行数:9,代码来源:validator.class.php


示例18: __construct

    public function __construct($mailbox, $username, $password, $code = null, $previous = null) {
        $this->mailbox = $mailbox;
        $this->username = $username;
        $this->password = $password;
        $this->imapErrors = \imap_errors();

        $message = 'Error connecting to: '.$mailbox.' with user: '.$username.' ['.  \imap_last_error().']';
        parent::__construct($message, $code, $previous);
    }
开发者ID:nathan-gs,项目名称:Calliope,代码行数:9,代码来源:ImapConnectException.php


示例19: connect

 public function connect()
 {
     $conf = Kohana::config('gmail');
     FB::log($conf, "conf");
     //{server.example.com:143/novalidate-cert}INBOX
     $this->inbox = imap_open($conf['connection']['hostname'], $conf['connection']['username'], $conf['connection']['password']) or die('Cannot connect to Gmail: ' . imap_last_error());
     FB::log($this->inbox);
     return $this;
 }
开发者ID:vantheman4,项目名称:kohana_gmail,代码行数:9,代码来源:gmail.php


示例20: __destruct

 /**
  * Destructs the connection, make sure all connections are closed
  * @return null
  */
 public function __destruct()
 {
     if (!$this->stream) {
         return;
     }
     if (!imap_close($this->stream)) {
         throw new MailException('Could not disconnect ' . $this->reference . ': ' . imap_last_error());
     }
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:13,代码来源:ClientConnection.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP imap_list函数代码示例发布时间:2022-05-15
下一篇:
PHP imap_headers函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap