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

PHP imap_errors函数代码示例

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

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



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

示例1: checkPassword

 /**
  * Check if the password is correct without logging in the user
  *
  * @param string $uid      The username
  * @param string $password The password
  *
  * @return true/false
  */
 public function checkPassword($uid, $password)
 {
     if (!function_exists('imap_open')) {
         OCP\Util::writeLog('user_external', 'ERROR: PHP imap extension is not installed', OCP\Util::ERROR);
         return false;
     }
     // Check if we only want logins from ONE domain and strip the domain part from UID
     if ($this->domain != '') {
         $pieces = explode('@', $uid);
         if (count($pieces) == 1) {
             $username = $uid . "@" . $this->domain;
         } elseif (count($pieces) == 2 and $pieces[1] == $this->domain) {
             $username = $uid;
             $uid = $pieces[0];
         } else {
             return false;
         }
     } else {
         $username = $uid;
     }
     $mbox = @imap_open($this->mailbox, $username, $password, OP_HALFOPEN, 1);
     imap_errors();
     imap_alerts();
     if ($mbox !== FALSE) {
         imap_close($mbox);
         $uid = mb_strtolower($uid);
         $this->storeUser($uid);
         return $uid;
     } else {
         return false;
     }
 }
开发者ID:kosli,项目名称:apps,代码行数:40,代码来源:imap.php


示例2: __destruct

 function __destruct()
 {
     // You will have iMap errors, even if there are no
     // mails on the server.  This suppresses that error.
     imap_errors();
     imap_close($this->connection);
 }
开发者ID:jmahmood,项目名称:MixiPOP3,代码行数:7,代码来源:pop3.php


示例3: addAccount

 function addAccount($_hookValues)
 {
     #_debug_array($_hookValues);
     $username = $_hookValues['account_lid'];
     $userPassword = $_hookValues['new_passwd'];
     #_debug_array($this->profileData);
     $imapAdminUsername = $this->profileData['imapAdminUsername'];
     $imapAdminPW = $this->profileData['imapAdminPW'];
     $folderNames = array("user.{$username}", "user.{$username}.Trash", "user.{$username}.Sent");
     // create the mailbox
     if ($mbox = @imap_open($this->getMailboxString(), $imapAdminUsername, $imapAdminPW)) {
         // create the users folders
         foreach ($folderNames as $mailBoxName) {
             if (imap_createmailbox($mbox, imap_utf7_encode("{" . $this->profileData['imapServer'] . "}{$mailBoxName}"))) {
                 if (!imap_setacl($mbox, $mailBoxName, $username, "lrswipcd")) {
                     # log error message
                 }
             }
         }
         imap_close($mbox);
     } else {
         _debug_array(imap_errors());
         return false;
     }
     // subscribe to the folders
     if ($mbox = @imap_open($this->getMailboxString(), $username, $userPassword)) {
         imap_subscribe($mbox, $this->getMailboxString('INBOX'));
         imap_subscribe($mbox, $this->getMailboxString('INBOX.Sent'));
         imap_subscribe($mbox, $this->getMailboxString('INBOX.Trash'));
         imap_close($mbox);
     } else {
         # log error message
     }
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:34,代码来源:class.cyrusimap.inc.php


示例4: download_and_process_email_replies

 /**
  * Primary method for downloading and processing email replies
  */
 public function download_and_process_email_replies($connection_details)
 {
     imap_timeout(IMAP_OPENTIMEOUT, apply_filters('supportflow_imap_open_timeout', 5));
     $ssl = $connection_details['imap_ssl'] ? '/ssl' : '';
     $ssl = apply_filters('supportflow_imap_ssl', $ssl, $connection_details['imap_host']);
     $mailbox = "{{$connection_details['imap_host']}:{$connection_details['imap_port']}{$ssl}}";
     $inbox = "{$mailbox}{$connection_details['inbox']}";
     $archive_box = "{$mailbox}{$connection_details['archive']}";
     $imap_connection = imap_open($mailbox, $connection_details['username'], $connection_details['password']);
     $redacted_connection_details = $connection_details;
     $redacted_connection_details['password'] = '[redacted]';
     // redact the password to avoid unnecessarily exposing it in logs
     $imap_errors = imap_errors();
     SupportFlow()->extend->logger->log('email_retrieve', __METHOD__, $imap_connection ? __('Successfully opened IMAP connection.', 'supportflow') : __('Failed to open IMAP connection.', 'supportflow'), compact('redacted_connection_details', 'mailbox', 'imap_errors'));
     if (!$imap_connection) {
         return new WP_Error('connection-error', __('Error connecting to mailbox', 'supportflow'));
     }
     // Check to see if the archive mailbox exists, and create it if it doesn't
     $mailboxes = imap_getmailboxes($imap_connection, $mailbox, '*');
     if (!wp_filter_object_list($mailboxes, array('name' => $archive_box))) {
         imap_createmailbox($imap_connection, $archive_box);
     }
     // Make sure here are new emails to process
     $email_count = imap_num_msg($imap_connection);
     if ($email_count < 1) {
         SupportFlow()->extend->logger->log('email_retrieve', __METHOD__, __('No new messages to process.', 'supportflow'), compact('mailboxes'));
         return false;
     }
     $emails = imap_search($imap_connection, 'ALL', SE_UID);
     $email_count = min($email_count, apply_filters('supportflow_max_email_process_count', 20));
     $emails = array_slice($emails, 0, $email_count);
     $processed = 0;
     // Process each new email and put it in the archive mailbox when done.
     foreach ($emails as $uid) {
         $email = new stdClass();
         $email->uid = $uid;
         $email->msgno = imap_msgno($imap_connection, $email->uid);
         $email->headers = imap_headerinfo($imap_connection, $email->msgno);
         $email->structure = imap_fetchstructure($imap_connection, $email->msgno);
         $email->body = $this->get_body_from_connection($imap_connection, $email->msgno);
         if (0 === strcasecmp($connection_details['username'], $email->headers->from[0]->mailbox . '@' . $email->headers->from[0]->host)) {
             $connection_details['password'] = '[redacted]';
             // redact the password to avoid unnecessarily exposing it in logs
             SupportFlow()->extend->logger->log('email_retrieve', __METHOD__, __('Skipping message because it was sent from a SupportFlow account.', 'supportflow'), compact('email'));
             continue;
         }
         // @todo Confirm this a message we want to process
         $result = $this->process_email($imap_connection, $email, $email->msgno, $connection_details['username'], $connection_details['account_id']);
         // If it was successful, move the email to the archive
         if ($result) {
             imap_mail_move($imap_connection, $email->uid, $connection_details['archive'], CP_UID);
             $processed++;
         }
     }
     imap_close($imap_connection, CL_EXPUNGE);
     $status_message = sprintf(__('Processed %d emails', 'supportflow'), $processed);
     SupportFlow()->extend->logger->log('email_retrieve', __METHOD__, $status_message);
     return $status_message;
 }
开发者ID:nagyistoce,项目名称:supportflow,代码行数:62,代码来源:class-supportflow-email-replies.php


示例5: Close

 public function Close()
 {
     //$this->IMAP2->setOptions('close', CL_EXPUNGE);
     $this->IMAP2->Expunge();
     $this->IMAP2->Close();
     imap_errors();
     // Clear error stack.
 }
开发者ID:unlight,项目名称:UsefulFunctions,代码行数:8,代码来源:class.imapmailbox.php


示例6: grabEventsFromEmailAction

 public function grabEventsFromEmailAction()
 {
     //echo phpinfo();
     $m = new manage_model_event();
     $m->emailGrab();
     core_debug::dump($m);
     core_debug::dump(imap_errors());
     die('at ctrl');
 }
开发者ID:vgalitsky,项目名称:git_trade,代码行数:9,代码来源:event.php


示例7: __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


示例8: __construct

 /**
  * Constructor - Establishes Connection to Email Host
  */
 function __construct($emailHost, $emailPort, $emailOptions, $emailLogin, $emailPassword, $catchAllBase = NULL)
 {
     $hostString = "{{$emailHost}:{$emailPort}/{$emailOptions}}";
     $this->mbox = imap_open($hostString, $emailLogin, $emailPassword, OP_SILENT) or die("can't connect: " . print_r(imap_errors()));
     // Remove all mail that may have been marked for deletion
     // via another process, E.g script that died
     imap_expunge($this->mbox);
     $this->connected = TRUE;
     $this->catchAllBase = $catchAllBase;
 }
开发者ID:ookwudili,项目名称:chisimba,代码行数:13,代码来源:attachmentreader_class_inc.php


示例9: open

 function open($mailbox = '')
 {
     if ($this->stream) {
         $this->close();
     }
     $this->target = "{" . $this->host . ":" . $this->port . "/" . $this->mode . ($this->security != "none" ? "/" . $this->security . "/novalidate-cert" : "") . "/readonly}";
     $this->stream = imap_open($this->target . $mailbox, $this->username, $this->password);
     if (!$this->stream) {
         throw new \Exception(implode(", ", imap_errors()));
     }
 }
开发者ID:kam1katze,项目名称:ocDashboard,代码行数:11,代码来源:imap.php


示例10: checkPassword

 /**
  * @brief Check if the password is correct
  * @param $uid The username
  * @param $password The password
  * @returns true/false
  *
  * Check if the password is correct without logging in the user
  */
 public function checkPassword($uid, $password)
 {
     $mbox = @imap_open($this->mailbox, $uid, $password);
     imap_errors();
     imap_alerts();
     if ($mbox) {
         imap_close($mbox);
         return $uid;
     } else {
         return false;
     }
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:20,代码来源:imap.php


示例11: initialize

 /**
  * Set the server, login, pass, service_flags, and mailbox
  *
  */
 public function initialize($init_array)
 {
     // connect to the specified account
     // these array items need to be the
     // same names as the config items OR
     // the db table fields that store the account info
     $this->host = $init_array['host'];
     $this->port = $init_array['port'];
     // get the port and server combined
     $this->server = $this->host . ':' . $this->port;
     $this->login = $init_array['login'];
     $this->pass = $init_array['pass'];
     $this->service_flags = $init_array['service_flags'];
     // default to INBOX mailbox since POP3 doesn't require it
     // and IMAP always has an INBOX
     $this->mailbox = isset($init_array['mailbox']) ? $init_array['mailbox'] : 'INBOX';
     // grab the resource returned by imap_open()
     // concatenate the IMAP connect spec string
     // expects server, flags, and mailbox to be set already
     $this->server_spec_string = $this->_generate_server_spec_string();
     // suppress warning with @ so we can handle it internally
     // which is the way that imap_errors() works
     $this->resource = @imap_open($this->server_spec_string, $this->login, $this->pass);
     // check for errors in the connection
     // calling imap_errors() clears all errors in the stack
     $err = imap_errors();
     // clear the message count in case this is a re-initialization
     $this->message_count = NULL;
     if ($this->resource) {
         $this->log_state('Connected to: ' . $this->server_spec_string);
         // when connection is good but the mailbox is empty,
         // the php imap c-libs report POP server empty mailbox as
         // "Mailbox is empty" (as a PHP error in the imap_errors() stack)
         // in case we are using IMAP, we also check get_message_count()
         if ($err[0] === 'Mailbox is empty' or $this->get_message_count() === 0) {
             // we now know there are zero messages
             $this->message_waiting = FALSE;
             $this->log_state('Mailbox is empty.');
         } else {
             // there is at least one message
             $this->message_waiting = TRUE;
             $this->log_state('At least one message available.');
         }
         $this->connected = TRUE;
     } else {
         // determine the specific reason for rejection/no connection
         $this->_handle_rejection($err);
         $this->log_state('Not connected. No email resource at: ' . $this->server_spec_string);
         $this->connected = FALSE;
     }
 }
开发者ID:anteknik,项目名称:tomanage,代码行数:55,代码来源:peeker_connect.php


示例12: Logoff

 function Logoff()
 {
     if ($this->_mbox) {
         // list all errors
         $errors = imap_errors();
         if (is_array($errors)) {
             foreach ($errors as $e) {
                 debugLog("IMAP-errors: {$e}");
             }
         }
         @imap_close($this->_mbox);
         debugLog("IMAP connection closed");
     }
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:14,代码来源:imap.php


示例13: authenticate

 /**
  * Authenticate connection
  *
  * @param string $username Username
  * @param string $password Password
  *
  * @return \Ddeboer\Imap\Connection
  * @throws AuthenticationFailedException
  */
 public function authenticate($username, $password)
 {
     $resource = @\imap_open($this->getServerString(), $username, $password, null, 1);
     if (false === $resource) {
         throw new AuthenticationFailedException($username);
     }
     $check = imap_check($resource);
     $mailbox = $check->Mailbox;
     $this->connection = substr($mailbox, 0, strpos($mailbox, '}') + 1);
     // These are necessary to get rid of PHP throwing IMAP errors
     imap_errors();
     imap_alerts();
     return new Connection($resource, $this->connection);
 }
开发者ID:ctalbot,项目名称:imap,代码行数:23,代码来源:Server.php


示例14: get_imap_connection

function get_imap_connection()
{
    $mbox = imap_open("{xxx.xxx.xxx.xxx:xxx/pop3/novalidate-cert}INBOX", "xml", "password") or die("can't connect: " . imap_last_error());
    if ($mbox) {
        // call this to avoid the mailbox is empty error message
        if (imap_num_msg($mbox) == 0) {
            $errors = imap_errors();
            if ($errors) {
                die("can't connect: " . imap_last_error());
            }
        }
    }
    return $mbox;
}
开发者ID:qwant50,项目名称:email-s-parser,代码行数:14,代码来源:get_exchange_v2.1.php


示例15: open

 public function open($server, $username, $password, $mailbox, array $flags)
 {
     if (!empty($flags)) {
         $server .= '/' . implode('/', $flags);
     }
     $mailbox = '{' . $server . '}' . $mailbox;
     $this->resource = @imap_open($mailbox, $username, $password);
     if (!$this->resource) {
         $error = imap_last_error();
         imap_errors();
         imap_alerts();
         throw new IMAPException($error);
     }
     return $this;
 }
开发者ID:rudiedirkx,项目名称:IMAP-reader,代码行数:15,代码来源:IMAPTransport.php


示例16: connect

 public function connect($mailboxName = '', $attempts = 3)
 {
     $this->resource = $this->getAddress($mailboxName);
     if ($this->connection != false) {
         $this->disconnect();
     }
     $options = $this->read_only ? OP_READONLY : 0;
     try {
         $this->connection = imap_open($this->resource, $this->username, $this->password, $options, $attempts);
     } catch (\ErrorException $e) {
         $message = $e->getMessage() . '. ' . implode("; ", imap_errors());
         throw new ConnectionFailedException($message);
     }
     return $this;
 }
开发者ID:raccoonsoftware,项目名称:LaravelImap,代码行数:15,代码来源:Client.php


示例17: index

 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     /* - - - - - - -  Gmail - - - - - -  */
     $stream = imap_open("{uranus.o2switch.net:993/imap/SSL}INBOX", "[email protected]", "N4tu73&P");
     $check = imap_check($stream);
     $list = imap_list($stream, "{uranus.o2switch.net}", "*");
     $getmailboxes = imap_getmailboxes($stream, "{uranus.o2switch.net}", "*");
     $headers = imap_headers($stream);
     $num_msg = imap_num_msg($stream);
     $status = imap_status($stream, "{uranus.o2switch.net:993/imap/SSL}INBOX", SA_ALL);
     $messages = imap_fetch_overview($stream, "1:" . $num_msg);
     $body = imap_body($stream, '1');
     $close = imap_close($stream);
     $errors = imap_errors();
     return view('Imap.Imap')->with(compact('resource'))->with(compact('check'))->with(compact('list'))->with(compact('getmailboxes'))->with(compact('headers'))->with(compact('num_msg'))->with(compact('status'))->with(compact('errors'))->with(compact('messages'))->with(compact('body'));
 }
开发者ID:gAb09,项目名称:NetP,代码行数:21,代码来源:ImapController.php


示例18: __construct

 /**
  * Connects to an IMAP or POP3 server
  * 
  * Please note that a connection to a POP3 server will have data remain
  * static over the lifetime of the connection, but an IMAP connection will
  * update in real time.
  * 
  * @param  string  $host            The POP3 host name
  * @param  string  $user            The user to log in as
  * @param  string  $password        The user's password
  * @param  string  $type            The type of connection: 'imap' or 'pop3'
  * @param  integer $port            The POP3 - only required if non-standard
  * @param  boolean $ssl             If SSL should be used for the connection
  * @param  boolean $silence_errors  If imap errors should be silenced
  * @return fPOP3
  */
 public function __construct($host, $user, $password, $type = 'imap', $port = NULL, $ssl = FALSE, $silence_errors = FALSE)
 {
     if ($type == 'imap' && $port === NULL) {
         $port = 143;
     } elseif ($type == 'pop3' && $port === NULL) {
         $port = 110;
     }
     $this->resource = imap_open('{' . $host . ':' . $port . '/' . $type . (!$ssl ? "/novalidate-cert" : "") . '}INBOX', $user, $password);
     $errors = imap_errors();
     if ($errors) {
         $errors = array_diff($errors, array('Mailbox is empty'));
     }
     if ($errors && !$silence_errors) {
         throw new fConnectivityException("The following IMAP errors occurred while connecting:\n%s", join("\n", $errors));
     }
 }
开发者ID:philip,项目名称:flourish,代码行数:32,代码来源:Imap.php


示例19: validateUserPassExternal

 /**
  * Validates a username and password over ldap
  *
  * @param string $username
  * @param string $password
  * @return bool
  */
 public function validateUserPassExternal($username, $password)
 {
     /* build connection string */
     $cert = BAIKAL_DAV_MAIL_CHECK_CERT ? "/validate-cert" : "/novalidate-cert";
     $url = "";
     switch (BAIKAL_DAV_MAIL_PROTOCOL) {
         case "imap":
             $url = "{" . BAIKAL_DAV_MAIL_SERVER . "/imap/notls}INBOX";
             break;
         case "imaps":
             $url = "{" . BAIKAL_DAV_MAIL_SERVER . "/imap/ssl{$cert}}INBOX";
             break;
         case "imaptls":
             $url = "{" . BAIKAL_DAV_MAIL_SERVER . "/imap/tls{$cert}}INBOX";
             break;
         case "pop3":
             $url = "{" . BAIKAL_DAV_MAIL_SERVER . "/pop3/notls}";
             break;
         case "pop3s":
             $url = "{" . BAIKAL_DAV_MAIL_SERVER . "/pop3/ssl{$cert}}";
             break;
         case "pop3tls":
             $url = "{" . BAIKAL_DAV_MAIL_SERVER . "/pop3/tls{$cert}}";
             break;
         case "smtp":
             $url = "{" . BAIKAL_DAV_MAIL_SERVER . "/smtp/notls}";
             break;
         case "smtps":
             $url = "{" . BAIKAL_DAV_MAIL_SERVER . "/smtp/ssl{$cert}}";
             break;
         case "smtptls":
             $url = "{" . BAIKAL_DAV_MAIL_SERVER . "/smtp/tls{$cert}}";
             break;
     }
     /* connect to mail server (only one try) */
     set_error_handler("\\Baikal\\Core\\MailAuth::exception_error_handler");
     $conn = imap_open($url, $username, $password, NULL, 0);
     restore_error_handler();
     if (!$conn) {
         return false;
     }
     /* skip notices, warnings and errors */
     imap_errors();
     /* close */
     imap_close($conn);
     return true;
 }
开发者ID:DamienCassou,项目名称:baikal_ynh,代码行数:54,代码来源:MailAuth.php


示例20: __construct

 /**
  * POP3アカウントに接続
  *
  * @param String $host
  * @param String $port
  * @param String $user
  * @param String $pass
  * @return vold
  * @codeCoverageIgnore
  */
 public function __construct($host, $user, $pass, $port = '110')
 {
     try {
         $this->inbox = imap_open('{' . $host . ':' . $port . '/pop3}', $user, $pass);
         $check = imap_check($this->inbox);
         $this->count = $check->Nmsgs;
         $this->overview = imap_fetch_overview($this->inbox, "1:{$this->count}", 0);
         foreach ($this->overview as $item) {
             $this->ids[] = $item->msgno;
         }
     } catch (Exception $e) {
         $erros = implode("; ", imap_errors());
         $msg = $e->getMessage();
         $ms = $msg . "\nPOP3 Errors: {$errors}";
         throw new Exception($mes);
     }
 }
开发者ID:kobabasu,项目名称:rest-slim,代码行数:27,代码来源:Inbox.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP imap_expunge函数代码示例发布时间:2022-05-15
下一篇:
PHP imap_deletemailbox函数代码示例发布时间: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