本文整理汇总了PHP中POP3::uidl方法的典型用法代码示例。如果您正苦于以下问题:PHP POP3::uidl方法的具体用法?PHP POP3::uidl怎么用?PHP POP3::uidl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类POP3
的用法示例。
在下文中一共展示了POP3::uidl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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)) {
//.........这里部分代码省略.........
示例2:
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;
}
// 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) {
Mail_Fetch_Status(_("Login OK: No new messages"));
$pop3->quit();
continue;
}
if ($Count == 0) {
Mail_Fetch_Status(_("Login OK: Inbox EMPTY"));
$pop3->quit();
示例3: workPopfetcher
//.........这里部分代码省略.........
$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;
}
// 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] = '';