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


PHP POP3::connect方法代码示例

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


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

示例1: EchoInfo

             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());
         }
     }
     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 {
开发者ID:rogerhub,项目名称:postie,代码行数:31,代码来源:postie_test.php

示例2: date

timer_start();
$use_cache = 1;
$output_debugging_info = 0;
# =1 if you want to output debugging info
$time_difference = get_settings('time_difference');
//echo "Server TimeZone is ".date('O')."<br />";
//Get Server Time Zone
// If Server Time Zone is not collect, Please comment out following line;
$server_timezone = date("O");
// 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);
$pop3 = new POP3();
if (!$pop3->connect($mailserver_url, $mailserver_port)) {
    echo "Ooops {$pop3->ERROR} <br />\n";
    exit;
}
$Count = $pop3->login($mailserver_login, $mailserver_pass);
if (!$Count || $Count == -1) {
    echo "<h1>Login Failed: {$pop3->ERROR}</h1>\n";
    $pop3->quit();
    exit;
}
// ONLY USE THIS IF YOUR PHP VERSION SUPPORTS IT!
//register_shutdown_function($pop3->quit());
for ($iCount = 1; $iCount <= $Count; $iCount++) {
    $MsgOne = $pop3->get($iCount);
    if (!$MsgOne || gettype($MsgOne) != 'array') {
        echo "oops, {$pop3->ERROR}<br />\n";
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-mail.php

示例3: sqgetGlobalVar

 $mailfetch_server = $mailfetch_server_[$i_loop];
 $mailfetch_port = $mailfetch_port_[$i_loop];
 $mailfetch_user = $mailfetch_user_[$i_loop];
 if ($mailfetch_pass_[$i_loop] == '') {
     sqgetGlobalVar("pass_{$i_loop}", $mailfetch_pass, SQ_POST);
 } else {
     $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];
 $pop3 = new POP3($mailfetch_server, 60);
 echo '<br>' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching from ") . htmlspecialchars($mailfetch_alias_[$i_loop] == '' ? $mailfetch_server : $mailfetch_alias_[$i_loop]) . '</b>', 'center'), '', $color[9]), '', '', 'width="90%"');
 flush();
 if (!$pop3->connect($mailfetch_server, $mailfetch_port)) {
     Mail_Fetch_Status(_("Oops, ") . $pop3->ERROR);
     continue;
 }
 Mail_Fetch_Status(_("Opening IMAP server"));
 $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10);
 // check if destination folder is not set, is not subscribed and is not \noselect folder
 if ($mailfetch_subfolder == '' || !mail_fetch_check_folder($imap_stream, $mailfetch_subfolder)) {
     $mailfetch_subfolder = 'INBOX';
 }
 Mail_Fetch_Status(_("Opening POP server"));
 $Count = $pop3->login($mailfetch_user, $mailfetch_pass);
 if (($Count == false || $Count == -1) && $pop3->ERROR != '') {
     Mail_Fetch_Status(_("Login Failed:") . ' ' . $pop3->ERROR);
     continue;
 }
开发者ID:jin255ff,项目名称:company_website,代码行数:31,代码来源:fetch.php

示例4: dirname

<?php

require dirname(__FILE__) . '/wp-config.php';
require_once ABSPATH . WPINC . '/class-pop3.php';
error_reporting(2037);
$time_difference = get_settings('gmt_offset') * 3600;
$phone_delim = '::';
$pop3 = new POP3();
if (!$pop3->connect(get_settings('mailserver_url'), get_settings('mailserver_port'))) {
    echo "Ooops {$pop3->ERROR} <br />\n";
    exit;
}
$count = $pop3->login(get_settings('mailserver_login'), get_settings('mailserver_pass'));
if (0 == $count) {
    die(__('There doesn&#8217;t seem to be any new mail.'));
}
for ($i = 1; $i <= $count; $i++) {
    $message = $pop3->get($i);
    $content = '';
    $content_type = '';
    $boundary = '';
    $bodysignal = 0;
    $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
    foreach ($message as $line) {
        if (strlen($line) < 3) {
            $bodysignal = 1;
        }
        if ($bodysignal) {
            $content .= $line;
        } else {
            if (preg_match('/Content-Type: /i', $line)) {
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:wp-mail.php

示例5: die

$db["user"] = "";
$db["pass"] = "";
$db["link"] = FALSE;
$db["use"] = "mail";
// optional
$db["dir_table"] = "inbox";
// Table for header data
$db["msg_table"] = "messages";
// Table for complete Messages (/w header)...
// Your own free Vars
// Save to MySQL ??
$savetomysql = TRUE;
$savetofile = TRUE;
$delete = FALSE;
$pop3 = new POP3($log, $log_file, $apop_detect);
if ($pop3->connect($server)) {
    if ($pop3->login($username, $password)) {
        if (!($msg_list = $pop3->get_office_status())) {
            echo $pop3->error;
            return;
        }
    } else {
        echo $pop3->error;
        return;
    }
} else {
    echo $pop3->error;
    return;
}
$db["link"] = mysql_connect($db["addr"], $db["user"], $db["pass"]) or die(mysql_error());
mysql_select_db($db["use"], $db["link"]) or die(mysql_error());
开发者ID:Webysther,项目名称:pop3,代码行数:31,代码来源:pop3_test.php

示例6: workPopfetcher

 function workPopfetcher(&$eventData)
 {
     global $serendipity;
     static $debug = null;
     if ($debug === null) {
         $debug = $this->debug = serendipity_db_bool($this->get_config('debug'));
     }
     // updertEntry() will not function unless this is set:
     $serendipity['POST']['properties']['fake'] = 'fake';
     $_SESSION['serendipityRightPublish'] = true;
     $this->out('<h3>' . PLUGIN_MF_NAME . ' v' . POPFETCHER_VERSION . ' @ ' . date("D M j G:i:s T Y") . '</h3>');
     $debug_file = null;
     // DEVELOPERS: If set to a filename, you can bypass fetching POP and use a file instead.
     $debug_mail = $this->get_config('debug_mail');
     if (strlen($debug_mail) != '' && file_exists($debug_mail)) {
         $debug_file = $debug_mail;
     }
     if ($debug_file != null) {
         $this->debug = true;
     }
     $authorid = $this->get_config('author');
     if (empty($authorid) || $authorid == 'empty') {
         $authorid = isset($serendipity['authorid']) ? $serendipity['authorid'] : 1;
     }
     $mailserver = trim($this->get_config('mailserver'));
     $mailport = $this->get_config('mailport');
     $mailuser = trim($this->get_config('mailuser'));
     $mailpass = trim($this->get_config('mailpass'));
     $timeout = $this->get_config('timeout');
     $deleteflag = serendipity_db_bool($this->get_config('deleteflag'));
     $apopflag = serendipity_db_bool($this->get_config('apopflag'));
     $blogflag = serendipity_db_bool($this->get_config('blogflag'));
     $striptagsflag = serendipity_db_bool($this->get_config('striptagsflag'));
     $publishflag = serendipity_db_bool($this->get_config('publishflag'));
     $onlyfrom = $this->get_config('onlyfrom', '');
     $maildir = trim($this->get_config('maildir'));
     $category = trim($this->get_config('category'));
     $adflag = serendipity_db_bool($this->get_config('adflag'));
     $plaintext_is_body_flag = serendipity_db_bool($this->get_config('plaintext_is_body'));
     $plaintext_use_extended_flag = serendipity_db_bool($this->get_config('plaintext_use_extended'));
     $list_virus = array('.pif', '.vbs', '.scr', '.bat', '.com', '.exe');
     $list_imagetype = array('jpg', 'jpeg', 'gif', 'png', 'x-png', 'pjpeg');
     $list_imageext = array('.gif', '.jpg', '.png', '.jpeg');
     $list_ignore = array('.smil');
     $output = '';
     $dirpath = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $maildir;
     $dupcount = 0;
     // Upload directory must end with a slash character
     if (strrchr($dirpath, '/') != '/') {
         $output = MF_ERROR7;
         $this->out('<br />' . $output . '<br />');
         return true;
     }
     // Upload directory must be writable
     if (!is_writable($dirpath)) {
         $output = MF_ERROR6;
         $this->out('<br />' . $output . '<br />');
         return true;
     }
     if (serendipity_db_bool($this->get_config('subfolder'))) {
         $dirpath = $dirpath . '/' . date('Y');
         if (!is_dir($dirpath)) {
             mkdir($dirpath);
         }
         $dirpath = $dirpath . '/' . date('m') . '/';
         if (!is_dir($dirpath)) {
             mkdir($dirpath);
         }
         $maildir .= date('Y') . '/' . date('m') . '/';
     }
     $maildir = str_replace('//', '/', $maildir);
     // Category (if specified) must exist
     if (!empty($category)) {
         $cid = serendipity_fetchCategoryInfo(null, $category);
         if ($cid == false) {
             $output = MF_ERROR8;
             $this->out('<br />' . $output . '<br />');
             return true;
         }
     }
     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;
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_popfetcher.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: 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

示例9: showDebug

error_reporting(E_ALL & ~E_NOTICE);
// ########################## REQUIRE BACK-END ############################
global $vbulletin;
require_once DIR . '/includes/qhvbmailer_functions.php';
require_once DIR . '/includes/qhvbmailer_class_pop3.php';
$pop3 = new POP3(false, "", true);
$debug = true;
// ######################## CHECK ADMIN PERMISSIONS #######################
if (!can_administer('canadminsettings')) {
    print_cp_no_permission();
}
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
showDebug("Running bounce management cron...");
if ($pop3->connect($vbulletin->options['qhvbmailer_smtphost'])) {
    showDebug("Connected to " . $vbulletin->options['qhvbmailer_smtphost']);
    if ($pop3->login($vbulletin->options['qhvbmailer_smtpuser'], $vbulletin->options['qhvbmailer_smtppass'])) {
        showDebug("Logged in using " . $vbulletin->options['qhvbmailer_smtpuser']);
        if ($msg_list = $pop3->get_office_status()) {
            showDebug("Fetched message list");
            showDebug();
            for ($i = 1; $i <= $msg_list["count_mails"]; $i++) {
                if (!($header = $pop3->get_top($i))) {
                    showDebug($pop3->error, 3);
                }
                $g = 0;
                while (!ereg("</HEADER>", $header[$g])) {
                    if (eregi("X-Failed-Recipients", $header[$g])) {
                        $email = trim(eregi_replace("X-Failed-Recipients: ", "", $header[$g]));
                        showDebug("Found bounce [" . $email . "]");
开发者ID:holandacz,项目名称:nb4,代码行数:31,代码来源:qhvbmailer_bounces.php

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

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

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

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

示例14: define

require_once ABSPATH . WPINC . '/class-pop3.php';
/** Only check at this interval for new messages. */
if (!defined('WP_MAIL_INTERVAL')) {
    define('WP_MAIL_INTERVAL', 300);
}
// 5 minutes
$last_checked = get_transient('mailserver_last_checked');
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') * 3600;
$phone_delim = '::';
$pop3 = new POP3();
$count = 0;
if (!$pop3->connect(get_option('mailserver_url'), get_option('mailserver_port')) || !$pop3->user(get_option('mailserver_login')) || !($count = $pop3->pass(get_option('mailserver_pass')))) {
    $pop3->quit();
    wp_die(0 === $count ? __('There doesn&#8217;t seem to be any new mail.') : esc_html($pop3->ERROR));
}
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) {
开发者ID:beaucollins,项目名称:wp,代码行数:31,代码来源:wp-mail.php

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


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