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


PHP POP3::quit方法代码示例

本文整理汇总了PHP中POP3::quit方法的典型用法代码示例。如果您正苦于以下问题:PHP POP3::quit方法的具体用法?PHP POP3::quit怎么用?PHP POP3::quit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在POP3的用法示例。


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

示例1: POP3MessageFetch

/**
 * Retrieves email via POP3
 */
function POP3MessageFetch($server = NULL, $port = NULL, $email = NULL, $password = NULL, $protocol = NULL, $offset = NULL, $test = NULL, $deleteMessages = true, $maxemails = 0)
{
    require_once ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php';
    $emails = array();
    $pop3 = new POP3();
    if (defined('POSTIE_DEBUG')) {
        $pop3->DEBUG = POSTIE_DEBUG;
    }
    DebugEcho("Connecting to {$server}:{$port} ({$protocol})");
    if ($pop3->connect(trim($server), $port)) {
        $msg_count = $pop3->login($email, $password);
        if ($msg_count === false) {
            $msg_count = 0;
        }
    } else {
        if (strpos($pop3->ERROR, "POP3: premature NOOP OK, NOT an RFC 1939 Compliant server") === false) {
            EchoInfo("Mail Connection Time Out. Common Reasons: Server Down, Network Issue, Port/Protocol MisMatch");
        }
        EchoInfo("The Server said: {$pop3->ERROR}");
        $msg_count = 0;
    }
    DebugEcho("message count: {$msg_count}");
    // loop through messages
    //$msgs = $pop3->pop_list();
    //DebugEcho("POP3MessageFetch: messages");
    //DebugDump($msgs);
    for ($i = 1; $i <= $msg_count; $i++) {
        $m = $pop3->get($i);
        if ($m !== false) {
            if (is_array($m)) {
                $emails[$i] = implode('', $m);
                if ($deleteMessages) {
                    if (!$pop3->delete($i)) {
                        EchoInfo('POP3MessageFetch: cannot delete message $i ' . $pop3->ERROR);
                        $pop3->reset();
                        exit;
                    }
                }
            } else {
                DebugEcho("POP3MessageFetch: message {$i} not an array");
            }
        } else {
            EchoInfo("POP3MessageFetch: message {$i} {$pop3->ERROR}");
        }
        if ($maxemails != 0 && $i >= $maxemails) {
            DebugEcho("Max emails ({$maxemails})");
            break;
        }
    }
    //clean up
    $pop3->quit();
    return $emails;
}
开发者ID:donwea,项目名称:nhap.org,代码行数:56,代码来源:postie-functions.php

示例2: wp_mail_receive

function wp_mail_receive()
{
    global $xoopsDB, $wpdb, $wp_id, $siteurl, $blog_charset, $wp_pop3;
    require_once ABSPATH . WPINC . '/class-pop3.php';
    timer_start();
    $use_cache = 1;
    $time_difference = get_settings('time_difference');
    // Get Server Time Zone
    // If Server Time Zone is not collect, Please comment out following line;
    $server_timezone = date("O");
    // echo "Server TimeZone is ".date('O')."<br />";
    // If Server Time Zone is not collect, Please uncomment following line and set collect timezone value;
    // $server_timezone = "+0900"; //This is a sample value for JST+0900
    $server_timezone = $server_timezone / 100;
    $weblog_timezone = $server_timezone + $time_difference;
    error_reporting(2037);
    $wp_pop3 = new POP3();
    if (!$wp_pop3->connect(get_settings('mailserver_url'), get_settings('mailserver_port'))) {
        echo "Ooops {$wp_pop3->ERROR} <br />\n";
        return;
    }
    $Count = $wp_pop3->login(get_settings('mailserver_login'), get_settings('mailserver_pass'));
    if ($Count == false) {
        if (!$wp_pop3->FP) {
            echo "Oooops Login Failed: {$wp_pop3->ERROR}<br />\n";
        } else {
            echo "No Message<br />\n";
            $wp_pop3->quit();
        }
        return;
    }
    // ONLY USE THIS IF YOUR PHP VERSION SUPPORTS IT!
    register_shutdown_function('wp_mail_quit');
    for ($iCount = 1; $iCount <= $Count; $iCount++) {
        $MsgOne = $wp_pop3->get($iCount);
        if (!$MsgOne || gettype($MsgOne) != 'array') {
            echo "oops, {$wp_pop3->ERROR}<br />\n";
            $wp_pop3->quit();
            return;
        }
        $content = '';
        $content_type = '';
        $boundary = '';
        $att_boundary = '';
        $hatt_boundary = '';
        $bodysignal = 0;
        $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
        while (list($lineNum, $line) = each($MsgOne)) {
            if (strlen($line) < 3) {
                $bodysignal = 1;
            }
            if ($bodysignal) {
                $content .= $line;
            } else {
                if (preg_match('/^Content-Type:\\s+(.*?)\\;/i', $line, $match)) {
                    $content_type = $match[1];
                    $content_type = strtolower($match[1]);
                }
                if ($content_type == 'multipart/mixed' && preg_match('/boundary=(?:")?([^;"\\s\\n]*?)(?:")?\\s*(?:$|;)/', $line, $match) && $att_boundary == '') {
                    $att_boundary = trim($match[1]);
                }
                if ($content_type == 'multipart/alternative' && preg_match('/boundary=(?:")?([^;"\\s\\n]*?)(?:")?\\s*(?:$|;)/', $line, $match) && $boundary == '') {
                    $boundary = trim($match[1]);
                }
                if ($content_type == 'multipart/related' && preg_match('/boundary=(?:")?([^;"\\s\\n]*?)(?:")?\\s*(?:$|;)/', $line, $match) && $hatt_boundary == '') {
                    $hatt_boundary = trim($match[1]);
                }
                if (preg_match('/Subject: /', $line)) {
                    $subject = trim($line);
                    $subject = substr($subject, 9, strlen($subject) - 9);
                    if (function_exists('mb_decode_mimeheader')) {
                        $subject1 = mb_decode_mimeheader($subject);
                        if ($subject != $subject) {
                            $sub_charset = mb_internal_encoding();
                        } else {
                            $sub_charset = "auto";
                        }
                        $subject = $subject1;
                    }
                    if (get_settings('use_phoneemail')) {
                        $subject = explode(get_settings('phoneemail_separator'), $subject);
                        $subject = trim($subject[0]);
                    }
                }
                if (preg_match('/Date: /', $line)) {
                    // of the form '20 Mar 2002 20:32:37'
                    $ddate = trim($line);
                    $ddate = str_replace('Date: ', '', $ddate);
                    if (strpos($ddate, ',')) {
                        $ddate = trim(substr($ddate, strpos($ddate, ',') + 1, strlen($ddate)));
                    }
                    $date_arr = explode(' ', $ddate);
                    $date_time = explode(':', $date_arr[3]);
                    $ddate_H = $date_time[0];
                    $ddate_i = $date_time[1];
                    $ddate_s = $date_time[2];
                    $ddate_m = $date_arr[1];
                    $ddate_d = $date_arr[0];
                    $ddate_Y = $date_arr[2];
                    $mail_timezone = trim(ereg_replace("\\([^)]*\\)", "", $date_arr[4])) / 100;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:101,代码来源:wp-mail.php

示例3: array

if ($last_checked) {
    wp_die(__('Slow down cowboy, no need to check for new mails so often!'));
}
set_transient('mailserver_last_checked', true, WP_MAIL_INTERVAL);
$time_difference = get_option('gmt_offset') * HOUR_IN_SECONDS;
$phone_delim = '::';
$pop3 = new POP3();
if (!$pop3->connect(get_option('mailserver_url'), get_option('mailserver_port')) || !$pop3->user(get_option('mailserver_login'))) {
    wp_die(esc_html($pop3->ERROR));
}
$count = $pop3->pass(get_option('mailserver_pass'));
if (false === $count) {
    wp_die(esc_html($pop3->ERROR));
}
if (0 === $count) {
    $pop3->quit();
    wp_die(__('There doesn&#8217;t seem to be any new mail.'));
}
for ($i = 1; $i <= $count; $i++) {
    $message = $pop3->get($i);
    $bodysignal = false;
    $boundary = '';
    $charset = '';
    $content = '';
    $content_type = '';
    $content_transfer_encoding = '';
    $post_author = 1;
    $author_found = false;
    $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
    foreach ($message as $line) {
        // Body signal.
开发者ID:gigikiri,项目名称:WordPress,代码行数:31,代码来源:wp-mail.php

示例4: mail_fetch_login

function mail_fetch_login()
{
    require_once SM_PATH . 'include/validate.php';
    include_once SM_PATH . 'functions/imap.php';
    require_once SM_PATH . 'plugins/mail_fetch/class.POP3.php';
    require_once SM_PATH . 'plugins/mail_fetch/functions.php';
    global $data_dir, $imapServerAddress, $imapPort;
    sqgetGlobalVar('username', $username, SQ_SESSION);
    sqgetGlobalVar('key', $key, SQ_COOKIE);
    $mailfetch_newlog = getPref($data_dir, $username, 'mailfetch_newlog');
    $outMsg = '';
    $mailfetch_server_number = getPref($data_dir, $username, 'mailfetch_server_number');
    if (!isset($mailfetch_server_number)) {
        $mailfetch_server_number = 0;
    }
    $mailfetch_cypher = getPref($data_dir, $username, 'mailfetch_cypher');
    if ($mailfetch_server_number < 1) {
        $mailfetch_server_number = 0;
    }
    for ($i_loop = 0; $i_loop < $mailfetch_server_number; $i_loop++) {
        $mailfetch_login_[$i_loop] = getPref($data_dir, $username, "mailfetch_login_{$i_loop}");
        $mailfetch_fref_[$i_loop] = getPref($data_dir, $username, "mailfetch_fref_{$i_loop}");
        $mailfetch_pass_[$i_loop] = getPref($data_dir, $username, "mailfetch_pass_{$i_loop}");
        if ($mailfetch_cypher == 'on') {
            $mailfetch_pass_[$i_loop] = decrypt($mailfetch_pass_[$i_loop]);
        }
        if ($mailfetch_pass_[$i_loop] != '' && ($mailfetch_login_[$i_loop] == 'on' && $mailfetch_newlog == 'on' || $mailfetch_fref_[$i_loop] == 'on')) {
            $mailfetch_server_[$i_loop] = getPref($data_dir, $username, "mailfetch_server_{$i_loop}");
            $mailfetch_port_[$i_loop] = getPref($data_dir, $username, "mailfetch_port_{$i_loop}");
            $mailfetch_alias_[$i_loop] = getPref($data_dir, $username, "mailfetch_alias_{$i_loop}");
            $mailfetch_user_[$i_loop] = getPref($data_dir, $username, "mailfetch_user_{$i_loop}");
            $mailfetch_lmos_[$i_loop] = getPref($data_dir, $username, "mailfetch_lmos_{$i_loop}");
            $mailfetch_uidl_[$i_loop] = getPref($data_dir, $username, "mailfetch_uidl_{$i_loop}");
            $mailfetch_subfolder_[$i_loop] = getPref($data_dir, $username, "mailfetch_subfolder_{$i_loop}");
            $mailfetch_server = $mailfetch_server_[$i_loop];
            $mailfetch_port = $mailfetch_port_[$i_loop];
            $mailfetch_user = $mailfetch_user_[$i_loop];
            $mailfetch_alias = $mailfetch_alias_[$i_loop];
            $mailfetch_pass = $mailfetch_pass_[$i_loop];
            $mailfetch_lmos = $mailfetch_lmos_[$i_loop];
            $mailfetch_login = $mailfetch_login_[$i_loop];
            $mailfetch_uidl = $mailfetch_uidl_[$i_loop];
            $mailfetch_subfolder = $mailfetch_subfolder_[$i_loop];
            // $outMsg .= "$mailfetch_alias checked<br>";
            // $outMsg .= "$mailfetch_alias_[$i_loop]<br>";
            $pop3 = new POP3($mailfetch_server, 60);
            if (!$pop3->connect($mailfetch_server, $mailfetch_port)) {
                $outMsg .= _("Warning, ") . $pop3->ERROR;
                continue;
            }
            $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10);
            $Count = $pop3->login($mailfetch_user, $mailfetch_pass);
            if (($Count == false || $Count == -1) && $pop3->ERROR != '') {
                $outMsg .= _("Login Failed:") . $pop3->ERROR;
                continue;
            }
            //   register_shutdown_function($pop3->quit());
            $msglist = $pop3->uidl();
            $i = 1;
            for ($j = 1; $j < sizeof($msglist); $j++) {
                if ($msglist["{$j}"] == $mailfetch_uidl) {
                    $i = $j + 1;
                    break;
                }
            }
            if ($Count < $i) {
                $pop3->quit();
                continue;
            }
            if ($Count == 0) {
                $pop3->quit();
                continue;
            } else {
                $newmsgcount = $Count - $i + 1;
            }
            // Faster to get them all at once
            $mailfetch_uidl = $pop3->uidl();
            if (!is_array($mailfetch_uidl) && $mailfetch_lmos == 'on') {
                $outMsg .= _("Server does not support UIDL.");
            }
            for (; $i <= $Count; $i++) {
                if (!ini_get('safe_mode')) {
                    set_time_limit(20);
                }
                // 20 seconds per message max
                $Message = "";
                $MessArray = $pop3->get($i);
                if (!$MessArray or gettype($MessArray) != "array") {
                    $outMsg .= _("Warning, ") . $pop3->ERROR;
                    continue 2;
                }
                while (list($lineNum, $line) = each($MessArray)) {
                    $Message .= $line;
                }
                /**
                 * check if mail folder is not null and subscribed
                 * Function can check if mail folder is only unsubscribed 
                 * and use unsubscribed mail folder.
                 */
                if ($mailfetch_subfolder == '' || !mail_fetch_check_folder($imap_stream, $mailfetch_subfolder)) {
//.........这里部分代码省略.........
开发者ID:jprice,项目名称:EHCP,代码行数:101,代码来源:setup.php

示例5: wp_mail_receive

function wp_mail_receive()
{
    global $wpdb, $wp_pop3, $img_target;
    require_once ABSPATH . WPINC . '/class-pop3.php';
    timer_start();
    $use_cache = 1;
    $time_difference = get_settings('time_difference');
    $blog_charset = get_settings('blog_charset');
    error_reporting(2037);
    $wp_pop3 = new POP3();
    if (!$wp_pop3->connect(get_settings('mailserver_url'), get_settings('mailserver_port'))) {
        echo "Ooops {$wp_pop3->ERROR} <br />\n";
        return;
    }
    $mail_count = $wp_pop3->login(get_settings('mailserver_login'), get_settings('mailserver_pass'));
    if ($mail_count == false) {
        if (!$wp_pop3->FP) {
            echo "Oooops Login Failed: {$wp_pop3->ERROR}<br />\n";
        } else {
            echo "No Message<br />\n";
            $wp_pop3->quit();
        }
        return;
    }
    // ONLY USE THIS IF YOUR PHP VERSION SUPPORTS IT!
    register_shutdown_function('wp_mail_quit');
    for ($mail_num = 1; $mail_num <= $mail_count; $mail_num++) {
        $MsgOne = $wp_pop3->get($mail_num);
        if (!$MsgOne || gettype($MsgOne) != 'array') {
            echo "oops, {$wp_pop3->ERROR}<br />\n";
            $wp_pop3->quit();
            return;
        }
        $content = '';
        $content_type = '';
        $boundary = '';
        $att_boundary = '';
        $hatt_boundary = '';
        $bodysignal = 0;
        $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
        while (list($lineNum, $line) = each($MsgOne)) {
            if (strlen($line) < 3) {
                $bodysignal = 1;
            }
            if ($bodysignal) {
                $content .= $line;
            } else {
                if (preg_match('/^Content-Type:\\s+(.*?)\\;/i', $line, $match)) {
                    $content_type = $match[1];
                    $content_type = strtolower($match[1]);
                }
                if ($content_type == 'multipart/mixed' && preg_match('/boundary=(?:")?([^;"\\s\\n]*?)(?:")?\\s*(?:$|;)/', $line, $match) && $att_boundary == '') {
                    $att_boundary = trim($match[1]);
                }
                if ($content_type == 'multipart/alternative' && preg_match('/boundary=(?:")?([^;"\\s\\n]*?)(?:")?\\s*(?:$|;)/', $line, $match) && $boundary == '') {
                    $boundary = trim($match[1]);
                }
                if ($content_type == 'multipart/related' && preg_match('/boundary=(?:")?([^;"\\s\\n]*?)(?:")?\\s*(?:$|;)/', $line, $match) && $hatt_boundary == '') {
                    $hatt_boundary = trim($match[1]);
                }
                if (preg_match('/Subject: /', $line)) {
                    $subject = trim($line);
                    $subject = substr($subject, 9, strlen($subject) - 9);
                    if (function_exists('mb_decode_mimeheader')) {
                        $subject1 = mb_decode_mimeheader($subject);
                        if ($subject != $subject) {
                            $sub_charset = mb_internal_encoding();
                        } else {
                            $sub_charset = "auto";
                        }
                        $subject = $subject1;
                    }
                    if (get_settings('use_phoneemail')) {
                        $subject = explode(get_settings('phoneemail_separator'), $subject);
                        $subject = trim($subject[0]);
                    }
                }
                if (preg_match('/Date: /', $line)) {
                    // of the form '20 Mar 2002 20:32:37'
                    $ddate = trim($line);
                    $ddate = str_replace('Date: ', '', $ddate);
                    if (strpos($ddate, ',')) {
                        $ddate = trim(substr($ddate, strpos($ddate, ',') + 1, strlen($ddate)));
                    }
                    $ddate_U = strtotime($ddate) + $time_difference * 3600;
                    $post_date = date('Y-m-d H:i:s', $ddate_U);
                }
            }
        }
        if (!ereg(get_settings('subjectprefix'), $subject)) {
            continue;
        }
        $charset = "";
        $ncharset = preg_match("/\\s?charset=\"?([A-Za-z0-9\\-]*)\"?/i", $content, $matches);
        if ($ncharset) {
            $charset = $matches[1];
        }
        $ddate_today = time() + $time_difference * 3600;
        $ddate_difference_days = ($ddate_today - $ddate_U) / 86400;
        if ($ddate_difference_days > 14) {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:101,代码来源:wp-mail.php

示例6: postie_test_config

function postie_test_config()
{
    $config = config_Read();
    extract($config);
    get_currentuserinfo();
    if (!current_user_can('manage_options')) {
        LogInfo("non-admin tried to set options");
        echo "<h2> Sorry only admin can run this file</h2>";
        exit;
    }
    ?>
    <div class="wrap">
        <h1>Postie Configuration Test</h1>
        <?php 
    postie_environment();
    ?>

        <h2>Clock Tests</h2>
        <p>This shows what time it would be if you posted right now</p>
        <?php 
    $content = "";
    $data = filter_Delay($content, null, $config['time_offset']);
    EchoInfo("Post time: {$data['0']}");
    ?>

        <h2>Connect to Mail Host</h2>

        <?php 
    if (!$mail_server || !$mail_server_port || !$mail_userid) {
        EchoInfo("FAIL - server settings not complete");
    } else {
        DebugEcho("checking");
    }
    switch (strtolower($config["input_protocol"])) {
        case 'imap':
        case 'imap-ssl':
        case 'pop3-ssl':
            if (!HasIMAPSupport()) {
                EchoInfo("Sorry - you do not have IMAP php module installed - it is required for this mail setting.");
            } else {
                require_once "postieIMAP.php";
                $mail_server =& PostieIMAP::Factory($config["input_protocol"]);
                if ($email_tls) {
                    $mail_server->TLSOn();
                }
                if (!$mail_server->connect($config["mail_server"], $config["mail_server_port"], $config["mail_userid"], $config["mail_password"])) {
                    EchoInfo("Unable to connect. The server said:");
                    EchoInfo($mail_server->error());
                } else {
                    EchoInfo("Successful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
                    EchoInfo("# of waiting messages: " . $mail_server->getNumberOfMessages());
                    $mail_server->disconnect();
                }
            }
            break;
        case 'pop3':
        default:
            require_once ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php';
            $pop3 = new POP3();
            if (defined('POSTIE_DEBUG')) {
                $pop3->DEBUG = POSTIE_DEBUG;
            }
            if (!$pop3->connect($config["mail_server"], $config["mail_server_port"])) {
                EchoInfo("Unable to connect. The server said:" . $pop3->ERROR);
            } else {
                EchoInfo("Sucessful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
                $msgs = $pop3->login($config["mail_userid"], $config["mail_password"]);
                if ($msgs === false) {
                    //workaround for bug reported here Apr 12, 2013
                    //https://sourceforge.net/tracker/?func=detail&atid=100311&aid=3610701&group_id=311
                    //originally repoted here:
                    //https://core.trac.wordpress.org/ticket/10587
                    if (empty($pop3->ERROR)) {
                        EchoInfo("No waiting messages");
                    } else {
                        EchoInfo("Unable to login. The server said:" . $pop3->ERROR);
                    }
                } else {
                    EchoInfo("# of waiting messages: {$msgs}");
                }
                $pop3->quit();
            }
            break;
    }
    ?>
    </div>
    <?php 
}
开发者ID:arnaudjuracek,项目名称:lopendoc,代码行数:88,代码来源:postie-functions.php

示例7: checkBounced

 public function checkBounced()
 {
     if ($this->config->get('ne_bounce') && $this->config->get('ne_bounce_email') && $this->config->get('ne_bounce_pop3_server') && $this->config->get('ne_bounce_pop3_user') && $this->config->get('ne_bounce_pop3_password')) {
         require_once DIR_SYSTEM . 'library/pop3_ne.php';
         $pop3 = new POP3();
         if (!@$pop3->connect($this->config->get('ne_bounce_pop3_server'), $this->config->get('ne_bounce_pop3_port') ? $this->config->get('ne_bounce_pop3_port') : 110) || !$pop3->user($this->config->get('ne_bounce_pop3_user'))) {
             return false;
         }
         $count = @$pop3->pass($this->config->get('ne_bounce_pop3_password'));
         if (false === $count) {
             return false;
         }
         if (0 === $count) {
             $pop3->quit();
             return false;
         }
         for ($i = 1; $i <= $count; $i++) {
             $message = $pop3->get($i);
             foreach ($message as $line) {
                 if (preg_match('/X-NEMail: /i', $line)) {
                     $hash = trim(str_replace('X-NEMail: ', '', $line));
                 }
             }
             if (isset($hash) && $hash) {
                 $hash = base64_decode(urldecode($hash));
                 $test = explode('|', $hash);
                 if (count($test) == 2) {
                     $data = array('uid' => $test[1], 'email' => $test[0]);
                     $query = $this->db->query("UPDATE `" . DB_PREFIX . "ne_stats_personal` SET bounced = '1' WHERE stats_personal_id = '" . (int) $data['uid'] . "' AND email = '" . $this->db->escape($data['email']) . "'");
                     if ($query) {
                         $pop3->delete($i);
                     } else {
                         $pop3->reset();
                     }
                 }
             } else {
                 if ($this->config->get('ne_bounce_delete')) {
                     $pop3->delete($i);
                 }
             }
         }
         $pop3->quit();
     }
 }
开发者ID:bgabor,项目名称:RenaniaOpencart,代码行数:44,代码来源:newsletter.php

示例8: ajax_bounce_test_check

 public function ajax_bounce_test_check()
 {
     $return['success'] = false;
     $return['msg'] = '';
     $passes = intval($_POST['passes']);
     $identifier = $_POST['identifier'];
     if (!mymail_option('bounce_active')) {
         $return['complete'] = true;
         echo json_encode($return);
         exit;
     }
     $server = mymail_option('bounce_server');
     $user = mymail_option('bounce_user');
     $pwd = mymail_option('bounce_pwd');
     if (!$server || !$user || !$pwd) {
         $return['complete'] = true;
         echo json_encode($return);
         exit;
     }
     if (mymail_option('bounce_ssl')) {
         $server = 'ssl://' . $server;
     }
     require_once ABSPATH . WPINC . '/class-pop3.php';
     $pop3 = new POP3();
     if (!$pop3->connect($server, mymail_option('bounce_port', 110)) || !$pop3->user($user)) {
         $return['complete'] = true;
         $return['msg'] = __('Unable to connect to bounce server! Please check your settings.', 'mymail');
         echo json_encode($return);
         exit;
     }
     $return['success'] = true;
     $count = $pop3->pass($pwd);
     $return['msg'] = __('checking for new messages', 'mymail') . str_repeat('.', $passes);
     if ($passes > 20) {
         $return['complete'] = true;
         $return['msg'] = __('Unable to get test message! Please check your settings.', 'mymail');
     }
     if (false === $count || 0 === $count) {
         if (0 === $count) {
             $pop3->quit();
         }
         echo json_encode($return);
         exit;
     }
     for ($i = 1; $i <= $count; $i++) {
         $message = $pop3->get($i);
         if (!$message) {
             continue;
         }
         $message = implode($message);
         if (strpos($message, $identifier)) {
             $pop3->delete($i);
             $pop3->quit();
             $return['complete'] = true;
             $return['msg'] = __('Your bounce server is good!', 'mymail');
             echo json_encode($return);
             exit;
         } else {
             $pop3->reset();
         }
     }
     $pop3->quit();
     echo json_encode($return);
     exit;
 }
开发者ID:ganastor,项目名称:LibraryBox-Custom-MediaBox-,代码行数:65,代码来源:settings.class.php

示例9: check_bounces

 private function check_bounces()
 {
     if (!mymail_option('bounce_active')) {
         return false;
     }
     do_action('mymail_check_bounces');
     $server = mymail_option('bounce_server');
     $user = mymail_option('bounce_user');
     $pwd = mymail_option('bounce_pwd');
     if (!$server || !$user || !$pwd) {
         return false;
     }
     if (get_transient('mymail_check_bounces_lock')) {
         return false;
     }
     //check bounces only every five minutes
     set_transient('mymail_check_bounces_lock', true, 360);
     if (mymail_option('bounce_ssl')) {
         $server = 'ssl://' . $server;
     }
     require_once ABSPATH . WPINC . '/class-pop3.php';
     $pop3 = new POP3();
     if (!$pop3->connect($server, mymail_option('bounce_port', 110)) || !$pop3->user($user)) {
         return false;
     }
     $count = $pop3->pass($pwd);
     if (false === $count) {
         return false;
     }
     if (0 === $count) {
         $pop3->quit();
         return false;
     }
     $delete_bounces = mymail_option('bounce_delete');
     //only max 1000 at once
     $count = min($count, 1000);
     for ($i = 1; $i <= $count; $i++) {
         $message = $pop3->get($i);
         if (!$message) {
             continue;
         }
         $message = implode($message);
         preg_match('#X-MyMail: ([a-f0-9]{32})#i', $message, $hash);
         preg_match('#X-MyMail-Campaign: (\\d+)#i', $message, $camp);
         if (!empty($hash) && !empty($camp)) {
             if ($this->reset_mail($hash[1], $camp[1])) {
                 $pop3->delete($i);
             } else {
                 $pop3->reset();
             }
         } else {
             if ($delete_bounces) {
                 $pop3->delete($i);
             }
         }
     }
     $pop3->quit();
     //do third party stuff
     $this->thirdpartystuff();
 }
开发者ID:ganastor,项目名称:LibraryBox-Custom-MediaBox-,代码行数:60,代码来源:mymail.class.php

示例10: getlist

 function getlist($mail_server, $mail_port, $mail_user, $mail_pass, $max = 10)
 {
     $maillists = array();
     $phone_delim = '::';
     $pop3 = new POP3();
     if (!$pop3->connect($mail_server, $mail_port) || !$pop3->user($mail_user) || !($count = $pop3->pass($mail_pass))) {
         $pop3->quit();
         $this->error = 0 === $count ? 'There doesn&#8217;t seem to be any new mail.' : $pop3->ERROR;
         return false;
     }
     $this->count = $count;
     var_dump($count);
     //if($count > $max )$count = $max;
     for ($i = $count; $i > $count - 1; $i--) {
         $message = $pop3->get($i);
         /*foreach($message as $m=>$n){
               //$n=iconv_mime_decode($n, 2, "gbk");
               $n=base64_decode($n);
               $n=mb_convert_encoding($n, 'gbk', 'gbk');
               var_dump($n);
               if(strpos($n,'http://bbs.scol.com.cn/member.php')!==FALSE){
                  var_dump($n);
               }
               if(strpos($n,'(如果上面不')!==FALSE){
                  var_dump($n);
               }
             
               //$n=mb_convert_encoding($n, 'gbk', 'gbk');
           
               
           }*/
         /*for($j=0;$j<=sizeof($message);$j++){
               $message[$j]=base64_decode($message[$j]);
           }*/
         var_dump(base64_decode($message[42]));
         var_dump(substr(base64_decode($message[41]), 12));
         var_dump(substr(base64_decode($message[42]), 0, -12));
         $bf = substr(base64_decode($message[41]), 17);
         $af = trim(substr(base64_decode($message[42]), 0, -20));
         //$url=substr(base64_decode($message[43]),12)+substr(base64_decode($message[44]),0,-12);
         var_dump($bf . $af);
         $all = str_replace("\n", '', $bf . $af);
         $all = str_replace(">", "", $all);
         $all = str_replace("&amp;", "&", $all);
         //$snoopy->fetch($bf.$af);
         //$re =mb_convert_encoding($snoopy->results,"utf-8","gbk");
         //print_r($re);
         //sleep(10);
         //echo "。";
         //echo "<br/>";
         $bodysignal = false;
         $boundary = '';
         $charset = '';
         $content = '';
         $content_type = '';
         $content_transfer_encoding = '';
         $post_author = 1;
         foreach ((array) $message as $line) {
             //var_dump($line);
             // body signal
             if (strlen($line) < 3) {
                 $bodysignal = true;
             }
             if ($bodysignal) {
                 $content .= $line;
             } else {
                 if (preg_match('/Content-Type: /i', $line)) {
                     $content_type = trim($line);
                     $content_type = substr($content_type, 14, strlen($content_type) - 14);
                     $content_type = explode(';', $content_type);
                     if (!empty($content_type[1])) {
                         $charset = explode('=', $content_type[1]);
                         $charset = !empty($charset[1]) ? trim($charset[1]) : '';
                     }
                     $content_type = $content_type[0];
                 }
                 if (preg_match('/Content-Transfer-Encoding: /i', $line)) {
                     $content_transfer_encoding = trim($line);
                     $content_transfer_encoding = substr($content_transfer_encoding, 27, strlen($content_transfer_encoding) - 27);
                     $content_transfer_encoding = explode(';', $content_transfer_encoding);
                     $content_transfer_encoding = $content_transfer_encoding[0];
                 }
                 if ($content_type == 'multipart/alternative' && false !== strpos($line, 'boundary="') && '' == $boundary) {
                     $boundary = trim($line);
                     $boundary = explode('"', $boundary);
                     $boundary = $boundary[1];
                 }
                 if (preg_match('/Subject: /i', $line)) {
                     $subject = trim($line);
                     $subject = substr($subject, 9, strlen($subject) - 9);
                     // Captures any text in the subject before $phone_delim as the subject
                     if (function_exists('iconv_mime_decode')) {
                         $subject = iconv_mime_decode($subject, 2, "UTF-8");
                     } else {
                         $subject = wp_iso_descrambler($subject);
                     }
                     $subject = explode($phone_delim, $subject);
                     $subject = $subject[0];
                 }
                 // Set the author using the email address (From or Reply-To, the last used)
//.........这里部分代码省略.........
开发者ID:niubiuz,项目名称:snoopy,代码行数:101,代码来源:phppop3.php

示例11: workPopfetcher


//.........这里部分代码省略.........
     if ($debug_file === null) {
         // Create new instance of POP3 connection
         $pop3 = new POP3($mailserver, $timeout);
         // Attempt to connect to mail server
         if (!$pop3->connect($mailserver, $mailport)) {
             $output = MF_ERROR1 . ': ' . $pop3->ERROR;
             $this->out('<br />' . $output . '<br />');
             return true;
         }
         // Try APOP login if requested, otherwise, regular login
         if ($apopflag) {
             $Count = $pop3->apop($mailuser, $mailpass);
         } else {
             $Count = $pop3->login($mailuser, $mailpass);
         }
         // Check for error retrieving number of msgs in mailbox
         if ($Count === false or $Count == -1) {
             $output = MF_ERROR2 . ': ' . $pop3->ERROR;
             $this->out('<br />' . $output . '<br />');
             return true;
         }
         // If no msgs in mailbox, exit
         if ($Count == 0) {
             $output = MF_MSG1;
             $this->out('<br />' . $output . '<br />');
             return true;
         }
         // Get the list of email msgs
         $msglist = $pop3->uidl();
         // Check for error in getting list of email msgs
         if (!is_array($msglist)) {
             $output = MF_ERROR3 . ': ' . $pop3->ERROR;
             $this->out('<br />' . $output . '<br />');
             $pop3->quit();
             return true;
         }
     } else {
         // Developer debug switch which reads from a file and not a POP3 connection.
         $dfiles = explode(':', $debug_file);
         $Count = count($dfiles);
     }
     $Message = array();
     // ************************
     // Fetch each email msg and attachments and put it into the $Message array
     // ************************
     for ($i = 1; $i <= $Count; $i++) {
         // Messages are numbered starting with '1', not '0'
         if ($debug_file === null) {
             $MessArray = $pop3->get($i);
         } else {
             $MessArray = file($dfiles[$i - 1]);
         }
         // Should have an array. If not, there was an error
         if (!$MessArray or gettype($MessArray) != "array") {
             $output = MF_ERROR4 . ': ' . $pop3->ERROR;
             $this->out('<br />' . $output . '<br />');
             $pop3->quit();
             return true;
         }
         // Extract the msg from MessArray and store it in Message
         $Message[$i - 1] = '';
         while (list($lineNum, $line) = each($MessArray)) {
             $Message[$i - 1] .= $line;
         }
         // Delete the msg
         if ($deleteflag && $debug_file === null) {
开发者ID:sqall01,项目名称:additional_plugins,代码行数:67,代码来源:serendipity_event_popfetcher.php

示例12: catch

    // Connect to the POP3 server
    $objPOP3->connect($strHost, $intPort, $arrConnectionTimeout, $bIPv6);
    // Logging in
    $objPOP3->login($strUser, $strPass);
    // Get the office status
    $arrOfficeStatus = $objPOP3->getOfficeStatus();
    /**
     * This for loop store the messages under their message number on the server
     * and mark the message as delete on the server.
     */
    for ($intMsgNum = 1; $intMsgNum <= $arrOfficeStatus["count"]; $intMsgNum++) {
        $objPOP3->saveToFileFromServer($intMsgNum, $strPathToDir, $strFileEndings);
        //        $objPOP3->deleteMsg($intMsgNum);
    }
    // Send the quit command and all as delete marked message will remove from the server.
    // IMPORTANT:
    // If you deleted many mails it could be that the +OK response will take some time.
    $objPOP3->quit();
    // Disconnect from the server
    // !!! CAUTION !!!
    // - this function does not send the QUIT command to the server
    //   so all as delete marked message will NOT delete
    //   To delete the mails from the server you have to send the quit command themself before disconnecting from the server
    $objPOP3->disconnect();
} catch (POP3_Exception $e) {
    die($e);
}
// Your next code
?>
 
开发者ID:Webysther,项目名称:pop3,代码行数:29,代码来源:pop3_test.php5.php


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