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

PHP imap_timeout函数代码示例

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

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



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

示例1: initImapStream

 /**
  * @return resource
  * @throws MailboxException
  */
 protected function initImapStream()
 {
     imap_timeout(IMAP_OPENTIMEOUT, 15);
     $imapStream = @imap_open($this->imapFullPath, $this->settings['user'], $this->settings['password'], $this->imapOptions, $this->imapRetriesNum, $this->imapParams);
     if (!$imapStream) {
         throw new MailboxException();
     }
     return $imapStream;
 }
开发者ID:Yame-,项目名称:mautic,代码行数:13,代码来源:Mailbox.php


示例2: __construct

 /**
  * Opens an IMAP stream
  */
 public function __construct()
 {
     // Set Imap Timeouts
     imap_timeout(IMAP_OPENTIMEOUT, 90);
     imap_timeout(IMAP_READTIMEOUT, 90);
     // 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" : "";
     /*
     More Info about above options at:
     http://php.net/manual/en/function.imap-open.php
     */
     $service = "{" . Kohana::config('settings.email_host') . ":" . Kohana::config('settings.email_port') . "/" . Kohana::config('settings.email_servertype') . $notls . $ssl . $novalidate . "}";
     // Check if the host name is valid, if not, set imap_stream as false and return false
     if (count(dns_get_record("" . Kohana::config('settings.email_host') . "")) == 0) {
         $this->imap_stream = false;
         return false;
     }
     if ($imap_stream = @imap_open($service, Kohana::config('settings.email_username'), Kohana::config('settings.email_password'))) {
         $this->imap_stream = $imap_stream;
     } else {
         // We don't usually want to break the entire scheduler process if email settings are off
         //   so lets return false instead of halting the entire script with a Kohana Exception.
         $this->imap_stream = false;
         return false;
         //throw new Kohana_Exception('imap.imap_stream_not_opened', $throwing_error);
     }
 }
开发者ID:redspider,项目名称:Ushahidi_Web,代码行数:35,代码来源:Imap.php


示例3: open

 public function open()
 {
     $this->baseMailbox = '{' . $this->host . ':' . $this->port . '/' . $this->type;
     if (in_array($this->security, ['ssl', 'tls'])) {
         $this->baseMailbox .= '/' . $this->security;
     }
     if ($this->validateCertificate !== null) {
         if ($this->validateCertificate) {
             $this->baseMailbox .= '/validate-cert';
         } else {
             $this->baseMailbox .= '/novalidate-cert';
         }
     }
     $this->baseMailbox .= '}INBOX';
     imap_timeout(IMAP_OPENTIMEOUT, 3);
     imap_timeout(IMAP_READTIMEOUT, 3);
     imap_timeout(IMAP_WRITETIMEOUT, 3);
     imap_timeout(IMAP_CLOSETIMEOUT, 3);
     ini_set('default_socket_timeout', 3);
     //error_reporting(0);
     $this->connection = imap_open($this->baseMailbox, $this->username, $this->password, 0, 1);
     /*if(! $this->connection)
       {
           var_dump($this->baseMailbox);
       }*/
     //error_reporting(-1);
     return !$this->connection;
 }
开发者ID:veronecrm,项目名称:mod.verone.mail,代码行数:28,代码来源:IMAP.php


示例4: imap_test_connect

function imap_test_connect($host,$user,$pass,$timeout=-1,$protocol="imap",$port=-1,$ssl=false,$debug=false)
{
global $NATS;
if ($timeout>0) $timeout=$timeout; // use specific for test if set
else
	{
	// otherwise use system if available
	if (isset($NATS)) $timeout=$NATS->Cfg->Get("test.imap.timeout",0);
	if ($timeout<=0) $timeout=0; // unset specifically or in environment
	}
	
if ($timeout>0) imap_timeout(IMAP_OPENTIMEOUT,$timeout);

if ($port<=0)
	{
	$port=143; // default
	if ( ($protocol=="imap") && ($ssl) ) $port=993;
	else if ($protocol=="pop3")
		{
		if ($ssl) $port=995;
		else $port=110;
		}
	}

$mailbox="{".$host.":".$port."/service=".$protocol;
if ($ssl) $mailbox.="/ssl";
$mailbox.="/novalidate-cert";
$mailbox.="}INBOX";
if ($debug) echo $user.":".$pass."@".$mailbox."\n";
$imap=@imap_open($mailbox,$user,$pass);
if ($imap===false) return 0;

@imap_close($imap);
return 1;
}
开发者ID:remap,项目名称:ndn-status,代码行数:35,代码来源:imap.inc.php


示例5: connect

 /**
  * @param Mirasvit_Helpdesk_Model_Gateway $gateway
  *
  * @return bool
  */
 public function connect($gateway)
 {
     $this->gateway = $gateway;
     $flags = sprintf('/%s', $gateway->getProtocol());
     if ($gateway->getEncryption() == 'ssl') {
         $flags .= '/ssl';
     }
     $flags .= '/novalidate-cert';
     // echo $flags;die;
     $server = new Mirasvit_Ddeboer_Imap_Server($gateway->getHost(), $gateway->getPort(), $flags);
     if (function_exists('imap_timeout')) {
         imap_timeout(1, 20);
     }
     if (!($this->connection = $server->authenticate($gateway->getLogin(), $gateway->getPassword()))) {
         return false;
     }
     $mailboxes = $this->connection->getMailboxNames();
     if (in_array('INBOX', $mailboxes)) {
         $mailboxName = 'INBOX';
     } elseif (in_array('Inbox', $mailboxes)) {
         $mailboxName = 'Inbox';
     } else {
         $mailboxName = $mailboxes[0];
     }
     $this->mailbox = $this->connection->getMailbox($mailboxName);
     return true;
 }
开发者ID:cesarfelip3,项目名称:clevermage_new,代码行数:32,代码来源:Mirasvit_Helpdesk_Helper_Fetch.php


示例6: MailFetcher

    function MailFetcher($username,$password,$hostname,$port,$protocol,$encryption='') {

        if(!strcasecmp($protocol,'pop')) //force pop3
            $protocol='pop3';

        $this->hostname=$hostname;
        $this->username=$username;
        $this->password=$password;
        $this->protocol=strtolower($protocol);
        $this->port = $port;
        $this->encryption = $encryption;

        $this->serverstr=sprintf('{%s:%d/%s',$this->hostname,$this->port,strtolower($this->protocol));
        if(!strcasecmp($this->encryption,'SSL')){
            $this->serverstr.='/ssl';
        }
        $this->serverstr.='/novalidate-cert}INBOX'; //add other flags here as needed.

        //echo $this->serverstr;
        //Charset to convert the mail to.
        $this->charset='UTF-8';
        //Set timeouts 
        if(function_exists('imap_timeout'))
            imap_timeout(1,20); //Open timeout.
    }
开发者ID:hungnv0789,项目名称:vhtm,代码行数:25,代码来源:class.mailfetch.php


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


示例8: __construct

 public function __construct($mailbox, $username, $password, $timeout = 30)
 {
     imap_timeout(IMAP_OPENTIMEOUT, $timeout);
     imap_timeout(IMAP_READTIMEOUT, $timeout);
     imap_timeout(IMAP_WRITETIMEOUT, $timeout);
     try {
         $this->count = imap_num_msg($this->imap = imap_open(\Zeyon\convert($mailbox, 'UTF7-IMAP'), \Zeyon\convert($username, 'UTF7-IMAP'), \Zeyon\convert($password, 'UTF7-IMAP'), OP_SILENT, 1));
     } catch (\Exception $e) {
         throw new \Exception('IMAP: ' . (($error = imap_last_error()) === false ? $e->getMessage() : $error));
     }
 }
开发者ID:dapepe,项目名称:tymio,代码行数:11,代码来源:mail.php


示例9: __construct

 /**
  * Opens an IMAP stream
  */
 public function __construct()
 {
     // Set Imap Timeouts
     imap_timeout(IMAP_OPENTIMEOUT, 90);
     imap_timeout(IMAP_READTIMEOUT, 90);
     $ssl = Kohana::config('settings.email_ssl') == true ? "ssl/novalidate-cert" : "";
     $service = "{" . Kohana::config('settings.email_host') . ":" . Kohana::config('settings.email_port') . "/" . Kohana::config('settings.email_servertype') . "/" . $ssl . "}";
     $imap_stream = imap_open($service, Kohana::config('settings.email_username'), Kohana::config('settings.email_password'));
     if (!$imap_stream) {
         throw new Kohana_Exception('imap.imap_stream_not_opened', imap_last_error());
     }
     $this->imap_stream = $imap_stream;
 }
开发者ID:newrooky,项目名称:Ushahidi_Web,代码行数:16,代码来源:Imap.php


示例10: __construct

 /**
  * Opens an IMAP stream
  */
 public function __construct()
 {
     // Set Imap Timeouts
     imap_timeout(IMAP_OPENTIMEOUT, 90);
     imap_timeout(IMAP_READTIMEOUT, 90);
     $config = Kohana::config('email');
     $ssl = $config['ssl'] == true ? "ssl/novalidate-cert" : "";
     $service = "{" . $config['server'] . ":" . $config['port'] . "/" . $config['servertype'] . "/" . $ssl . "}";
     $imap_stream = imap_open($service, $config['username'], $config['password']);
     if (!$imap_stream) {
         throw new Kohana_Exception('imap.imap_stream_not_opened', imap_last_error());
     }
     $this->imap_stream = $imap_stream;
 }
开发者ID:rabble,项目名称:Ushahidi_Web,代码行数:17,代码来源:Imap.php


示例11: __construct

 /**
  * constructor
  *
  * @param CSourcePOP $source Source POP
  */
 function __construct($source)
 {
     //stock the source
     $this->source = $source;
     if (!function_exists("imap_open")) {
         CModelObject::error("FE-IMAP-support-not-available");
     }
     //initialise open TIMEOUT
     imap_timeout(1, $this->source->timeout);
     //lets create the string for stream
     $type = $this->source->type == "pop3" ? "/" . $this->source->type : "";
     $ssl = $this->source->auth_ssl == "SSL/TLS" ? "/ssl/novalidate-cert" : "/notls";
     $port = $this->source->port ? ":" . $this->source->port : "";
     $extension = $this->source->extension ? $this->source->extension : "";
     return $this->_server = "{" . $this->source->host . $port . $type . $ssl . "}" . $extension;
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:21,代码来源:CPop.class.php


示例12: connect

 function connect()
 {
     ob_start();
     $buff = imap_alerts();
     $buff = imap_errors();
     $timeout = $this->config->get('bounce_timeout');
     if (!empty($timeout)) {
         imap_timeout(IMAP_OPENTIMEOUT, $timeout);
     }
     $port = $this->config->get('bounce_port', '');
     $secure = $this->config->get('bounce_secured', '');
     $protocol = $this->config->get('bounce_connection', '');
     $serverName = '{' . $this->config->get('bounce_server');
     if (empty($port)) {
         if ($secure == 'ssl' && $protocol == 'imap') {
             $port = '993';
         } elseif ($protocol == 'imap') {
             $port = '143';
         } elseif ($protocol == 'pop3') {
             $port = '110';
         }
     }
     if (!empty($port)) {
         $serverName .= ':' . $port;
     }
     if (!empty($secure)) {
         $serverName .= '/' . $secure;
     }
     if ($this->config->get('bounce_certif', false)) {
         $serverName .= '/novalidate-cert';
     }
     if (!empty($protocol)) {
         $serverName .= '/service=' . $protocol;
     }
     $serverName .= '}';
     $this->mailbox = imap_open($serverName, $this->config->get('bounce_username'), $this->config->get('bounce_password'));
     $warnings = ob_get_clean();
     if (!empty($warnings) && $this->report) {
         acymailing::display($warnings, 'warning');
     }
     return $this->mailbox ? true : false;
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:42,代码来源:bounce.php


示例13: MailFetcher

 function MailFetcher($email, $charset = 'UTF-8')
 {
     if ($email && is_numeric($email)) {
         //email_id
         $email = Email::lookup($email);
     }
     if (is_object($email)) {
         $this->ht = $email->getMailAccountInfo();
     } elseif (is_array($email) && $email['host']) {
         //hashtable of mail account info
         $this->ht = $email;
     } else {
         $this->ht = null;
     }
     $this->charset = $charset;
     if ($this->ht) {
         if (!strcasecmp($this->ht['protocol'], 'pop')) {
             //force pop3
             $this->ht['protocol'] = 'pop3';
         } else {
             $this->ht['protocol'] = strtolower($this->ht['protocol']);
         }
         //Max fetch per poll
         if (!$this->ht['max_fetch'] || !is_numeric($this->ht['max_fetch'])) {
             $this->ht['max_fetch'] = 20;
         }
         //Mail server string
         $this->srvstr = sprintf('{%s:%d/%s', $this->getHost(), $this->getPort(), $this->getProtocol());
         if (!strcasecmp($this->getEncryption(), 'SSL')) {
             $this->srvstr .= '/ssl';
         }
         $this->srvstr .= '/novalidate-cert}';
     }
     //Set timeouts
     if (function_exists('imap_timeout')) {
         imap_timeout(1, 20);
     }
 }
开发者ID:KM-MFG,项目名称:osTicket-1.8,代码行数:38,代码来源:class.mailfetch.php


示例14: __construct

 /**
  * Opens an IMAP stream
  */
 public function __construct()
 {
     // Set Imap Timeouts
     imap_timeout(IMAP_OPENTIMEOUT, 90);
     imap_timeout(IMAP_READTIMEOUT, 90);
     // 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" : "";
     /*
     More Info about above options at:
     http://php.net/manual/en/function.imap-open.php
     */
     $service = "{" . Kohana::config('settings.email_host') . ":" . Kohana::config('settings.email_port') . "/" . Kohana::config('settings.email_servertype') . $notls . $ssl . $novalidate . "}";
     $imap_stream = imap_open($service, Kohana::config('settings.email_username'), Kohana::config('settings.email_password'));
     if (!$imap_stream) {
         throw new Kohana_Exception('imap.imap_stream_not_opened', imap_last_error());
     }
     $this->imap_stream = $imap_stream;
 }
开发者ID:kiirti,项目名称:Ushahidi_MHI,代码行数:26,代码来源:Imap.php


示例15: explode

$download_data = explode("::", base64_decode($_POST["download_data"]));
$download_dir = $_POST["download_dir"];
//print_r($download_data);
$mbox_name = $download_data[0];
$use_ssl = $download_data[1];
$validate_cert = $download_data[2];
$username = $download_data[3];
$password = $download_data[4];
$use_tls = $download_data[5];
$folder = $download_data[6];
$msg_number = (int) $download_data[7];
$attachment_name = $download_data[8];
imap_timeout(15, IMAP_OPENTIMEOUT);
imap_timeout(15, IMAP_READTIMEOUT);
imap_timeout(15, IMAP_WRITETIMEOUT);
imap_timeout(15, IMAP_CLOSETIMEOUT);
$use_ssl_flag = $use_ssl == "true" ? "/ssl" : "";
$validate_cert_flag = $validate_cert == "true" ? "" : "/novalidate-cert";
$use_tls_flag = $use_tls == "true" ? "/tls" : "";
$mbox = imap_open("{" . $mbox_name . $use_ssl_flag . $validate_cert_flag . $use_tls_flag . "}{$folder}", $username, $password);
//print_r(imap_errors());
$message = new MailMessage($mbox, $msg_number);
//print_r($message);
$attachments = $message->getAttachments();
//print_r($attachments);
$download_data = null;
if ($attachment_name == '*') {
    if (class_exists("ZipArchive")) {
        $attachment_name = "{$download_dir}/attachments-{$msg_number}.zip";
        $zip = new ZipArchive();
        $zip->open($attachment_name, ZipArchive::CREATE);
开发者ID:TouTrix,项目名称:mailcwp,代码行数:31,代码来源:mailcwp-download.php


示例16: imap_connect

 public static function imap_connect($user, $password, $folder = 'INBOX')
 {
     global $log;
     $log->debug("Entering OSSMail_Record_Model::imap_connect({$user} , {$password} , {$folder}) method ...");
     $roundcube_config = self::load_roundcube_config();
     $a_host = parse_url($roundcube_config['default_host']);
     $validatecert = '';
     if ($a_host['host']) {
         $host = $a_host['host'];
         $ssl_mode = isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl', 'imaps', 'tls')) ? $a_host['scheme'] : null;
         if (!empty($a_host['port'])) {
             $port = $a_host['port'];
         } else {
             if ($ssl_mode && $ssl_mode != 'tls' && (!$roundcube_config['default_port'] || $roundcube_config['default_port'] == 143)) {
                 $port = 993;
             }
         }
     } else {
         $host = $roundcube_config['default_host'];
         if ($roundcube_config['default_port'] == 993) {
             $ssl_mode = 'ssl';
         } else {
             $ssl_mode = 'tls';
         }
         $port = $roundcube_config['default_port'];
     }
     if (empty($port)) {
         $port = $roundcube_config['default_port'];
     }
     if (!$roundcube_config['validate_cert']) {
         $validatecert = '/novalidate-cert';
     }
     imap_timeout(IMAP_OPENTIMEOUT, 5);
     $log->debug("imap_open({" . $host . ":" . $port . "/imap/" . $ssl_mode . $validatecert . "}{$folder}, {$user} , {$password}) method ...");
     $mbox = @imap_open("{" . $host . ":" . $port . "/imap/" . $ssl_mode . $validatecert . "}{$folder}", $user, $password) or die(self::imap_open_error(imap_last_error()));
     $log->debug("Exit OSSMail_Record_Model::imap_connect() method ...");
     return $mbox;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:38,代码来源:Record.php


示例17: processBounce

 /**
  * Function to process each individual message
  * @param int    $pos            (message number)
  * @param string $type           (DNS or BODY type)
  * @param string $totalFetched   (total number of messages in mailbox)
  * @return boolean
  */
 function processBounce($pos, $type, $totalFetched)
 {
     $header = imap_header($this->_mailbox_link, $pos);
     $subject = strip_tags($header->subject);
     $met = ini_get('max_execution_time');
     if ($met < 6000 && $met != 0) {
         set_time_limit(6000);
     }
     imap_timeout(IMAP_READTIMEOUT, 6000);
     imap_timeout(IMAP_WRITETIMEOUT, 6000);
     if ($type == 'DSN') {
         // first part of DSN (Delivery Status Notification), human-readable explanation
         $dsn_msg = imap_fetchbody($this->_mailbox_link, $pos, "1");
         $dsn_msg_structure = imap_bodystruct($this->_mailbox_link, $pos, "1");
         if ($dsn_msg_structure->encoding == 4) {
             $dsn_msg = quoted_printable_decode($dsn_msg);
         } elseif ($dsn_msg_structure->encoding == 3) {
             $dsn_msg = base64_decode($dsn_msg);
         }
         // second part of DSN (Delivery Status Notification), delivery-status
         $dsn_report = imap_fetchbody($this->_mailbox_link, $pos, "2");
         // process bounces by rules
         $result = bmhDSNRules($dsn_msg, $dsn_report, $this->debug_dsn_rule);
     } elseif ($type == 'BODY') {
         $structure = imap_fetchstructure($this->_mailbox_link, $pos);
         switch ($structure->type) {
             case 0:
                 // Content-type = text
             // Content-type = text
             case 1:
                 // Content-type = multipart
                 $body = imap_fetchbody($this->_mailbox_link, $pos, "1");
                 // Detect encoding and decode - only base64
                 if (!empty($structure->parts[0]->encoding) && $structure->parts[0]->encoding == 4) {
                     $body = quoted_printable_decode($body);
                 } elseif (!empty($structure->parts[0]->encoding) && $structure->parts[0]->encoding == 3) {
                     $body = base64_decode($body);
                 }
                 $result = bmhBodyRules($body, $structure, $this->debug_body_rule);
                 break;
             case 2:
                 // Content-type = message
                 $body = imap_body($this->_mailbox_link, $pos);
                 if ($structure->encoding == 4) {
                     $body = quoted_printable_decode($body);
                 } elseif ($structure->encoding == 3) {
                     $body = base64_decode($body);
                 }
                 $body = substr($body, 0, 1000);
                 $result = bmhBodyRules($body, $structure, $this->debug_body_rule);
                 break;
             default:
                 // unsupport Content-type
                 $this->output('Msg #' . $pos . ' is unsupported Content-Type:' . $structure->type, VERBOSE_REPORT);
                 return false;
         }
     } else {
         // internal error
         $this->error_msg = 'Internal Error: unknown type';
         return false;
     }
     $email = $result['email'];
     $bounce_type = $result['bounce_type'];
     if ($this->moveHard && $result['remove'] == 1) {
         $remove = 'moved (hard)';
     } elseif ($this->moveSoft && $result['remove'] == 1) {
         $remove = 'moved (soft)';
     } elseif ($this->disable_delete) {
         $remove = 0;
     } else {
         $remove = $result['remove'];
     }
     $rule_no = $result['rule_no'];
     $rule_cat = $result['rule_cat'];
     $xheader = false;
     if ($rule_no == '0000') {
         // internal error      return false;
         // code below will use the Callback function, but return no value
         if (trim($email) == '') {
             $email = $header->fromaddress;
         }
         $params = array($pos, $body, $bounce_type, $email, $subject, $xheader, $remove, $rule_no, $rule_cat, $totalFetched);
         call_user_func_array($this->action_function, $params);
     } else {
         // match rule, do bounce action
         if ($this->testmode) {
             $this->output('Match: ' . $rule_no . ':' . $rule_cat . '; ' . $bounce_type . '; ' . $email);
             return true;
         } else {
             $params = array($pos, $body, $bounce_type, $email, $subject, $xheader, $remove, $rule_no, $rule_cat, $totalFetched);
             return call_user_func_array($this->action_function, $params);
         }
     }
//.........这里部分代码省略.........
开发者ID:Rikisha,项目名称:proj,代码行数:101,代码来源:class.phpmailer-bmh.php


示例18: _client_generateMailAccountsList

/**
 * Generate Mail accounts list
 *
 * @param iMSCP_pTemplate $tpl reference to the template object
 * @param int $mainDmnId Customer main domain unique identifier
 * @return int number of subdomain mails addresses
 */
function _client_generateMailAccountsList($tpl, $mainDmnId)
{
    /** @var $cfg iMSCP_Config_Handler_File */
    $cfg = iMSCP_Registry::get('config');
    $stmt = exec_query("\n\t\t\tSELECT\n\t\t\t\t`mail_id`, `mail_pass`,\n\t\t\t \tCONCAT(LEFT(`mail_forward`, 30), IF(LENGTH(`mail_forward`) > 30, '...', '')) AS `mail_forward`,\n\t\t\t \t`mail_type`, `status`, `mail_auto_respond`, `quota`, `mail_addr`\n\t\t\tFROM\n\t\t\t\t`mail_users`\n\t\t\tWHERE\n\t\t\t\t`domain_id` = ?\n\t\t\tAND\n\t\t\t\t`mail_type` NOT LIKE '%catchall%'\n\t\t\tORDER BY\n\t\t\t\t`mail_addr` ASC, `mail_type` DESC\n\t\t", $mainDmnId);
    $rowCount = $stmt->rowCount();
    if (!$rowCount) {
        return 0;
    } else {
        $mainDmnProps = get_domain_default_props($_SESSION['user_id']);
        $mailQuotaLimit = $mainDmnProps['mail_quota'] ? bytesHuman($mainDmnProps['mail_quota']) : 0;
        $imapAvailable = function_exists('imap_open');
        if ($imapAvailable) {
            imap_timeout(IMAP_OPENTIMEOUT, 1);
            imap_timeout(IMAP_READTIMEOUT, 2);
            imap_timeout(IMAP_CLOSETIMEOUT, 4);
        }
        $imapTimeoutReached = false;
        while ($row = $stmt->fetchRow(PDO::FETCH_ASSOC)) {
            list($mailDelete, $mailDeleteScript, $mailEdit, $mailEditScript) = _client_generateUserMailAction($row['mail_id'], $row['status']);
            $mailAddr = $row['mail_addr'];
            $mailTypes = explode(',', $row['mail_type']);
            $mailType = '';
            $isMailbox = 0;
            foreach ($mailTypes as $type) {
                $mailType .= user_trans_mail_type($type);
                if (strpos($type, '_forward') !== false) {
                    $mailType .= ': ' . str_replace(',', ', ', $row['mail_forward']);
                } else {
                    $isMailbox = 1;
                }
                $mailType .= '<br />';
            }
            if ($isMailbox && $row['status'] == 'ok') {
                if ($imapAvailable) {
                    $quotaMax = $row['quota'];
                    if ($quotaMax) {
                        if (!$imapTimeoutReached && ($imapStream = @imap_open("{localhost/notls}", $mailAddr, $row['mail_pass'], OP_HALFOPEN))) {
                            $quotaUsage = imap_get_quotaroot($imapStream, 'INBOX');
                            imap_close($imapStream);
                            if (!empty($quotaUsage)) {
                                $quotaUsage = $quotaUsage['usage'] * 1024;
                            } else {
                                $quotaUsage = 0;
                            }
                            $quotaMax = bytesHuman($quotaMax);
                            $txtQuota = $mailQuotaLimit ? tr('%s / %s of %s', bytesHuman($quotaUsage), $quotaMax, $mailQuotaLimit) : sprintf('%s / %s', bytesHuman($quotaUsage), $quotaMax);
                        } else {
                            $imapTimeoutReached = true;
                            $txtQuota = tr('Info Unavailable');
                        }
                    } else {
                        $txtQuota = tr('unlimited');
                    }
                } else {
                    $txtQuota = tr('Info Unavailable');
                }
            } else {
                $txtQuota = '---';
            }
            $tpl->assign(array('MAIL_ADDR' => tohtml(decode_idna($mailAddr)), 'MAIL_TYPE' => $mailType, 'MAIL_STATUS' => translate_dmn_status($row['status']), 'MAIL_DELETE' => $mailDelete, 'MAIL_DELETE_SCRIPT' => $mailDeleteScript, 'MAIL_EDIT' => $mailEdit, 'MAIL_EDIT_SCRIPT' => $mailEditScript, 'MAIL_QUOTA_VALUE' => $txtQuota, 'DEL_ITEM' => $row['mail_id'], 'DISABLED_DEL_ITEM' => $row['status'] != 'ok' ? $cfg->HTML_DISABLED : ''));
            _client_generateUserMailAutoRespond($tpl, $row['mail_id'], $row['status'], $row['mail_auto_respond']);
            $tpl->parse('MAIL_ITEM', '.mail_item');
        }
        return $rowCount;
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:74,代码来源:mail_accounts.php


示例19: imap_timeout

<?php

echo "Checking with no parameters\n";
imap_timeout();
echo "Checking with incorrect parameter type\n";
imap_timeout('');
imap_timeout(false);
echo "GET values:\n";
var_dump(imap_timeout(IMAP_OPENTIMEOUT));
var_dump(imap_timeout(IMAP_READTIMEOUT));
var_dump(imap_timeout(IMAP_WRITETIMEOUT));
var_dump(imap_timeout(IMAP_CLOSETIMEOUT));
echo "SET values:\n";
var_dump(imap_timeout(IMAP_OPENTIMEOUT, 10));
var_dump(imap_timeout(IMAP_READTIMEOUT, 10));
var_dump(imap_timeout(IMAP_WRITETIMEOUT, 10));
//IMAP_CLOSETIMEOUT not implemented
//var_dump(imap_timeout(IMAP_CLOSETIMEOUT, 10));
echo "CHECK values:\n";
var_dump(imap_timeout(IMAP_OPENTIMEOUT));
var_dump(imap_timeout(IMAP_READTIMEOUT));
var_dump(imap_timeout(IMAP_WRITETIMEOUT));
//IMAP_CLOSETIMEOUT not implemented
//var_dump(imap_timeout(IMAP_CLOSETIMEOUT));
开发者ID:badlamer,项目名称:hhvm,代码行数:24,代码来源:imap_timeout_basic.php


示例20: mailcwp_handler

function mailcwp_handler($atts, $content, $tag)
{
    $smarty = new Smarty();
    $smarty->setTemplateDir(plugin_dir_path(__FILE__) . 'templates');
    $smarty->setCompileDir(plugin_dir_path(__FILE__) . 'templates_c');
    $smarty->setCacheDir(plugin_dir_path(__FILE__) . '/cache');
    if (!is_user_logged_in()) {
        //wp_die(__("Please login to view this page.", "mailcwp"));
        //wp_redirect(wp_login_url("$_SERVER[PHP_SELF]"));
        echo "<p>Please login to view this page.</p><p>You will be redirected in a moment. If you are not redirected click <a href=\"#\" onclick=\"window.location = '" . wp_login_url() . "?redirect_to=' + window.location.href;\">here</a>.<script type=\"text/javascript\">window.location = '" . wp_login_url() . "?redirect_to=' + window.location.href;</script>";
        exit;
    }
    //add_filter( 'show_admin_bar', '__return_false' );
    $options = get_option("mailcwp_settings", array());
    $hide_admin_bar = isset($options["hide_admin_bar"]) ? $options["hide_admin_bar"] : true;
    $hide_page_title = isset($options["hide_page_title"]) ? $options["hide_page_title"] : true;
    if (isset($options) && !empty($options)) {
        imap_timeout(isset($options["imap_open_timeout"]) ? $options["imap_open_timeout"] : 15, IMAP_OPENTIMEOUT);
        imap_timeout(isset($options["imap_read_timeout"]) ? $options["imap_read_timeout"] : 15, IMAP_READTIMEOUT);
        imap_timeout(isset($options["imap_write_timeout"]) ? $options["imap_write_timeout"] : 15, IMAP_WRITETIMEOUT);
        imap_timeout(isset($options["imap_close_timeout"]) ? $options["imap_close_timeout"] : 15, IMAP_CLOSETIMEOUT);
        //write_log("TIMEZONE SET " . date_default_timezone_set('Australia/Melbourne'));
    }
    $current_user = wp_get_current_user();
    $accounts = get_user_meta($current_user->ID, "mailcwp_accounts", true);
    $default_account_id = get_user_meta($current_user->ID, "mailcwp_account_default", true);
    //write_log("CURRENT USER " . print_r($current_user, true));
    //write_log("Accounts " . print_r($accounts, true));
    $smarty->assign('labels', array("compose" => __("Compose New Message", "mailcwp"), "refresh" => __("Refresh Folders", "mailcwp"), "options" => __("Options", "mailcwp"), "themes" => __("Theme", "mailcwp"), "mark_read" => __("Mark Read", "mailcwp"), "mark_unread" => __("Mark Unread", "mailcwp"), "delete" => __("Delete", "mailcwp"), "search" => __("Find Messages", "mailcwp")));
    $smarty->assign('user_change_theme', isset($options) && isset($options["user_change_theme"]) ? $options["user_change_theme"] : true);
    $smarty->assign('set1_extensions', apply_filters("mailcwp_toolbar_set1", ""));
    $smarty->assign('set2_extensions', apply_filters("mailcwp_toolbar_set2", ""));
    $smarty->assign('set_search_extensions', apply_filters("mailcwp_toolbar_set_search", ""));
    $smarty->assign('progress_bar_src', plugins_url("/img/ajax_loading.gif", __FILE__));
    echo apply_filters("mailcwp_toolbar", $smarty->fetch('toolbar.tpl'));
    //$smarty->clear_all_assign();
    delete_user_meta($current_user->ID, 'mailcwp_session');
    $mailcwp_session = null;
    /*$smarty->assign('accounts', $accounts);
      $passwords = array();
      $folders = array();
      if (is_array($accounts)) {
        foreach ($accounts as $account) {
          if (isset($account["id"])) {
            $password = mailcwp_get_account_password($account);
            $passwords[$account["id"]] = $password;
          }
        }
      }
      $smarty->assign('passwords', $passwords);*/
    ?>
  <div id="mailcwp_container" class="ui-widget-content">
    <div id="mailcwp_accounts" class="ui-widget-content">
      <?php 
    if (is_array($accounts)) {
        for ($mode = 0; $mode <= 1; $mode++) {
            foreach ($accounts as $account) {
                if (isset($account["id"])) {
                    if ($mode == 0 && isset($default_account_id) && $account["id"] == $default_account_id || $mode == 1 && isset($default_account_id) && $account["id"] != $default_account_id || !isset($default_account_id)) {
                        ?>
	      <h3 id="<?php 
                        echo $account["id"];
                        ?>
"><?php 
                        echo $account["name"];
                        ?>
</h3>
	      <div>
		<?php 
                        $password = mailcwp_get_account_password($account);
                        //present password page
                        if (empty($password)) {
                            echo mailcwp_login_dialog($account["id"]);
                            echo "</div>";
                        } else {
                            $mbox_name = $account["host"] . ":" . $account["port"];
                            $use_ssl_flag = $account["use_ssl"] ? "/ssl" : "";
                            $use_tls_flag = $account["use_tls"] ? "/tls" : "";
                            //write_log("ACCOUNT $account[name]: $account[use_ssl]");
         

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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