mirror of
https://github.com/e107inc/e107.git
synced 2025-07-29 10:50:25 +02:00
Upgraded PHPMailer to 5.2.9 and corrected mail overrides.
This commit is contained in:
@@ -453,9 +453,14 @@ class mailout_main_ui extends e_admin_ui
|
||||
'subject' => LAN_MAILOUT_113." ".$add,
|
||||
'body' => str_replace("[br]", "\n", LAN_MAILOUT_114),
|
||||
'template' => vartrue($_POST['testtemplate'],null),
|
||||
'shortcodes' => array('USERID'=>555, 'USERNAME'=>'John Smith', 'LOGINNAME'=>'TestName', 'PASSWORD'=>'xxxxxxx', 'ACTIVATION_LINK'=>SITEURL."signup.php#activate")
|
||||
'shortcodes' => array('USERID'=>555, 'USERNAME'=>'John Smith', 'LOGINNAME'=>'TestName', 'PASSWORD'=>'xxxxxxx', 'ACTIVATION_LINK'=>SITEURL."signup.php#activate"),
|
||||
);
|
||||
|
||||
if(E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
$eml['SMTPDebug'] = true;
|
||||
}
|
||||
|
||||
if (!e107::getEmail()->sendEmail($sendto, LAN_MAILOUT_189, $eml))
|
||||
{
|
||||
$mes->addError(($pref['mailer'] == 'smtp') ? LAN_MAILOUT_67 : LAN_MAILOUT_106);
|
||||
|
@@ -297,6 +297,11 @@ $EMAIL_TEMPLATE['example']['footer'] = "<br /><br />
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
// Overrides any data sent from script.
|
||||
$EMAIL_TEMPLATE['example']['cc'] = "example@example.com";
|
||||
$EMAIL_TEMPLATE['example']['bcc'] = "example@example.com";
|
||||
$EMAIL_TEMPLATE['example']['attachment'] = "{e_PLUGIN}myplugin/myattachment.zip";
|
||||
$EMAIL_TEMPLATE['example']['priority'] = 3; // (1 = High, 3 = Normal, 5 = low).
|
||||
|
||||
|
||||
|
||||
|
@@ -310,7 +310,8 @@ class e_bbcode
|
||||
|
||||
$code_text = $code_text_par;
|
||||
|
||||
|
||||
$className = null;
|
||||
$debugFile = null;
|
||||
|
||||
if (is_array($this->bbList) && array_key_exists($code, $this->bbList))
|
||||
{ // Check the bbcode 'cache'
|
||||
|
@@ -130,7 +130,9 @@ if (!defined('e107_INIT')) { exit; }
|
||||
//define('MAIL_DEBUG',TRUE);
|
||||
//define('LOG_CALLER', TRUE);
|
||||
|
||||
require_once(e_HANDLER.'phpmailer/class.phpmailer.php');
|
||||
//require_once(e_HANDLER.'phpmailer/class.phpmailer.php');
|
||||
//require_once(e_HANDLER.'phpmailer/class.smtp.php');
|
||||
require_once(e_HANDLER.'phpmailer/PHPMailerAutoload.php');
|
||||
|
||||
// Directory for log (if enabled)
|
||||
define('MAIL_LOG_PATH',e_LOG);
|
||||
@@ -157,6 +159,28 @@ class e107Email extends PHPMailer
|
||||
private $debug = false; // echos various debug info when set to true.
|
||||
private $pref = array(); // Store code prefs.
|
||||
private $previewMode = false;
|
||||
private $overrides = array(
|
||||
// Legacy // New
|
||||
'SMTPDebug' => 'SMTPDebug',
|
||||
'subject' => 'subject',
|
||||
'email_sender_email' => 'sender_email',
|
||||
'email_sender_name' => 'sender_name',
|
||||
'email_replyto' => 'replyto',
|
||||
'send_html' => 'html',
|
||||
'email_attach' => 'attachment',
|
||||
'email_copy_to' => 'cc',
|
||||
'email_bcopy_to' => 'bcc',
|
||||
'bouncepath' => 'bouncepath',
|
||||
'returnreceipt' => 'returnreceipt',
|
||||
'email_priority' => 'priority',
|
||||
'extra_header' => 'extra_header',
|
||||
'wordwrap' => 'wordwrap',
|
||||
'split' => 'split',
|
||||
'smtp_server' => 'smtp_server',
|
||||
'smtp_username' => 'smtp_username',
|
||||
'smtp_password' => 'smtp_password',
|
||||
|
||||
);
|
||||
/**
|
||||
* Constructor sets up all the global options, and sensible defaults - it should be the only place the prefs are accessed
|
||||
*
|
||||
@@ -191,11 +215,13 @@ class e107Email extends PHPMailer
|
||||
{
|
||||
if (!isset($overrides[$k])) $overrides[$k] = $pref[$k];
|
||||
}
|
||||
|
||||
|
||||
$this->pause_amount = varset($pref['mail_pause'], 10);
|
||||
$this->pause_time = varset($pref['mail_pausetime'], 1);
|
||||
$this->allow_html = varset($pref['mail_sendstyle'],'textonly') == 'texthtml' ? true : 1;
|
||||
|
||||
if (varsettrue($pref['mail_options'])) $this->general_opts = explode(',',$pref['mail_options'],'');
|
||||
if (vartrue($pref['mail_options'])) $this->general_opts = explode(',',$pref['mail_options'],'');
|
||||
|
||||
if ($this->debug)
|
||||
{
|
||||
@@ -220,8 +246,8 @@ class e107Email extends PHPMailer
|
||||
case 'smtp' :
|
||||
$smtp_options = array();
|
||||
$temp_opts = explode(',',varset($pref['smtp_options'],''));
|
||||
if (varsettrue($overrides ['smtp_pop3auth'])) $temp_opts[] = 'pop3auth'; // Legacy option - remove later
|
||||
if (varsettrue($pref['smtp_keepalive'])) $temp_opts[] = 'keepalive'; // Legacy option - remove later
|
||||
if (vartrue($overrides ['smtp_pop3auth'])) $temp_opts[] = 'pop3auth'; // Legacy option - remove later
|
||||
if (vartrue($pref['smtp_keepalive'])) $temp_opts[] = 'keepalive'; // Legacy option - remove later
|
||||
foreach ($temp_opts as $k=>$v)
|
||||
{
|
||||
if (strpos($v,'=') !== FALSE)
|
||||
@@ -237,7 +263,7 @@ class e107Email extends PHPMailer
|
||||
unset($temp_opts);
|
||||
|
||||
$this->IsSMTP(); // Enable SMTP functions
|
||||
if (varsettrue($smtp_options['helo'])) $this->Helo = $smtp_options['helo'];
|
||||
if (vartrue($smtp_options['helo'])) $this->Helo = $smtp_options['helo'];
|
||||
|
||||
if (isset($smtp_options['pop3auth'])) // We've made sure this is set
|
||||
{ // Need POP-before-SMTP authorisation
|
||||
@@ -275,31 +301,39 @@ class e107Email extends PHPMailer
|
||||
break;
|
||||
case 'sendmail' :
|
||||
$this->Mailer = 'sendmail';
|
||||
$this->Sendmail = ($overrides['sendmail']) ? $overrides['sendmail'] : '/usr/sbin/sendmail -t -i -r '.varsettrue($pref['replyto_email'],$overrides['siteadminemail']);
|
||||
$this->Sendmail = ($overrides['sendmail']) ? $overrides['sendmail'] : '/usr/sbin/sendmail -t -i -r '.vartrue($pref['replyto_email'],$overrides['siteadminemail']);
|
||||
break;
|
||||
case 'php' :
|
||||
$this->Mailer = 'mail';
|
||||
break;
|
||||
}
|
||||
if (varsettrue($pref['mail_bounce_email'])) $this->Sender = $pref['mail_bounce_email'];
|
||||
|
||||
$this->FromName = $tp->toHTML(varsettrue($pref['replyto_name'],$overrides['siteadmin']),'','RAWTEXT');
|
||||
$this->From = $tp->toHTML(varsettrue($pref['replyto_email'],$overrides['siteadminemail']),'','RAWTEXT');
|
||||
$this->WordWrap = 76; // Set a sensible default
|
||||
|
||||
if (vartrue($pref['mail_bounce_email'])) $this->Sender = $pref['mail_bounce_email'];
|
||||
|
||||
$this->FromName = $tp->toHTML(vartrue($pref['replyto_name'],$overrides['siteadmin']),'','RAWTEXT');
|
||||
$this->From = $tp->toHTML(vartrue($pref['replyto_email'],$overrides['siteadminemail']),'','RAWTEXT');
|
||||
$this->WordWrap = 76; // Set a sensible default
|
||||
|
||||
// Now look for any overrides - slightly cumbersome way of doing it, but does give control over what can be set from here
|
||||
// Options are those accepted by the arraySet() method.
|
||||
foreach (array('SMTPDebug', 'email_subject', 'email_sender_email', 'email_sender_name', 'email_replyto', 'send_html',
|
||||
'add_html_header', 'email_attach', 'email_copy_to', 'email_bcopy_to',
|
||||
'bouncepath', 'returnreceipt', 'email_inline_images', 'email_priority', 'extra_header', 'wordwrap', 'split') as $opt)
|
||||
if(!empty($overrides))
|
||||
{
|
||||
if (isset($overrides[$opt]))
|
||||
foreach ($this->overrides as $key =>$opt)
|
||||
{
|
||||
$this->arraySet(array($opt => $overrides[$opt]));
|
||||
if (isset($overrides[$key]))
|
||||
{
|
||||
$this->arraySet(array($opt => $overrides[$key]));
|
||||
}
|
||||
elseif(!empty($overrides[$opt]))
|
||||
{
|
||||
$this->arraySet(array($opt => $overrides[$opt]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set log level
|
||||
* @param int $level 0|1|2
|
||||
@@ -623,8 +657,8 @@ class e107Email extends PHPMailer
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
$eml['shortcodes']['BODY'] = $tp->toEmail($eml['body']);
|
||||
$eml['shortcodes']['SUBJECT'] = $eml['subject'];
|
||||
$eml['shortcodes']['BODY'] = !empty($eml['body']) ? $tp->toEmail($eml['body']) : '';
|
||||
$eml['shortcodes']['SUBJECT'] = !empty($eml['subject']) ?$eml['subject'] : '';
|
||||
$eml['shortcodes']['THEME'] = ($this->previewMode == true) ? e_THEME_ABS.$this->pref['sitetheme'].'/' : e_THEME.$this->pref['sitetheme'].'/'; // Always use front-end theme path.
|
||||
|
||||
|
||||
@@ -668,6 +702,7 @@ class e107Email extends PHPMailer
|
||||
public function arraySet($eml)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$tmpl = null;
|
||||
|
||||
// Cleanup legacy key names. ie. remove 'email_' prefix.
|
||||
foreach($eml as $k=>$v)
|
||||
@@ -728,38 +763,45 @@ class e107Email extends PHPMailer
|
||||
}
|
||||
|
||||
|
||||
// Perform Override from template.
|
||||
foreach($this->overrides as $k=>$v)
|
||||
{
|
||||
if(!empty($tmpl[$v]))
|
||||
{
|
||||
$eml[$v] = $tmpl[$v];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isset($eml['SMTPDebug'])) $this->SMTPDebug = $eml['SMTPDebug']; // 'FALSE' is a valid value!
|
||||
$identifier = deftrue('MAIL_IDENTIFIER', 'X-e107-id');
|
||||
|
||||
if (vartrue($eml['sender_email'])) $this->From = $eml['sender_email'];
|
||||
if (vartrue($eml['sender_name'])) $this->FromName = $eml['sender_name'];
|
||||
if (vartrue($eml['replyto'])) $this->AddAddressList('replyto',$eml['replyto'],vartrue($eml['replytonames'],''));
|
||||
if (isset($eml['send_html'])) $this->allow_html = $eml['send_html']; // 'FALSE' is a valid value!
|
||||
if (isset($eml['add_html_header'])) $this->add_HTML_header = $eml['add_html_header']; // 'FALSE' is a valid value!
|
||||
if (vartrue($eml['body'])) $this->makeBody($eml['body'], $this->allow_html, $this->add_HTML_header);
|
||||
if (vartrue($eml['attach'])) $this->attach($eml['attach']);
|
||||
if (vartrue($eml['copy_to'])) $this->AddAddressList('cc',$eml['copy_to'],vartrue($eml['cc_names'],''));
|
||||
if (vartrue($eml['bcopy_to'])) $this->AddAddressList('bcc',$eml['bcopy_to'],vartrue($eml['bcc_names'],''));
|
||||
|
||||
if (vartrue($eml['bouncepath']))
|
||||
if (isset($eml['SMTPDebug'])) { $this->SMTPDebug = $eml['SMTPDebug']; } // 'FALSE' is a valid value!
|
||||
if (!empty($eml['sender_email'])) { $this->From = $eml['sender_email']; }
|
||||
if (!empty($eml['sender_name'])) { $this->FromName = $eml['sender_name']; }
|
||||
if (!empty($eml['replyto'])) { $this->AddAddressList('replyto',$eml['replyto'],vartrue($eml['replytonames'],'')); }
|
||||
if (isset($eml['html'])) { $this->allow_html = $eml['html']; } // 'FALSE' is a valid value!
|
||||
if (isset($eml['html_header'])) { $this->add_HTML_header = $eml['html_header']; } // 'FALSE' is a valid value!
|
||||
if (!empty($eml['body'])) { $this->makeBody($eml['body'], $this->allow_html, $this->add_HTML_header); }
|
||||
if (!empty($eml['attachment'])) { $this->attach($eml['attachment']); }
|
||||
if (!empty($eml['cc'])) { $this->AddAddressList('cc',$eml['cc'],vartrue($eml['cc_names'],'')); }
|
||||
if (!empty($eml['bcc'])) { $this->AddAddressList('bcc',$eml['bcc'],vartrue($eml['bcc_names'],'')); }
|
||||
if (!empty($eml['returnreceipt'])) { $this->ConfirmReadingTo = $eml['returnreceipt']; }
|
||||
if (!empty($eml['inline_images'])) { $this->addInlineImages($eml['inline_images']); }
|
||||
if (!empty($eml['priority'])) { $this->Priority = $eml['priority']; }
|
||||
if (!empty($eml['e107_header'])) { $this->AddCustomHeader($identifier.": {$eml['e107_header']}"); }
|
||||
if (!empty($eml['wordwrap'])) { $this->WordWrap = $eml['wordwrap']; }
|
||||
if (!empty($eml['split'])) { $this->SingleTo = ($eml['split'] != FALSE); }
|
||||
if (!empty($eml['smtp_username'])) { $this->Username = $eml['smtp_username']; }
|
||||
if (!empty($eml['smtp_password'])) { $this->Password = $eml['smtp_password']; }
|
||||
|
||||
if (!empty($eml['bouncepath']))
|
||||
{
|
||||
$this->Sender = $eml['bouncepath']; // Bounce path
|
||||
$this->save_bouncepath = $eml['bouncepath']; // Bounce path
|
||||
}
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
echo "<h4>e107Email::arraySet() - line ".__LINE__."</h4>";
|
||||
print_a($eml);
|
||||
}
|
||||
|
||||
$identifier = deftrue('MAIL_IDENTIFIER', 'X-e107-id');
|
||||
|
||||
if (vartrue($eml['returnreceipt'])) $this->ConfirmReadingTo = $eml['returnreceipt'];
|
||||
if (vartrue($eml['inline_images'])) $this->addInlineImages($eml['inline_images']);
|
||||
if (vartrue($eml['priority'])) $this->Priority = $eml['priority'];
|
||||
if (vartrue($eml['e107_header'])) $this->AddCustomHeader($identifier.": {$eml['e107_header']}");
|
||||
if (vartrue($eml['extra_header']))
|
||||
|
||||
if (!empty($eml['extra_header']))
|
||||
{
|
||||
if (is_array($eml['extra_header']))
|
||||
{
|
||||
@@ -774,8 +816,17 @@ class e107Email extends PHPMailer
|
||||
}
|
||||
}
|
||||
|
||||
if (varset($eml['wordwrap'])) $this->WordWrap = $eml['wordwrap'];
|
||||
if (vartrue($eml['split'])) $this->SingleTo = ($eml['split'] != FALSE);
|
||||
// print_a($eml);
|
||||
|
||||
if($this->debug)
|
||||
{
|
||||
echo "<h4>e107Email::arraySet() - line ".__LINE__."</h4>";
|
||||
print_a($eml);
|
||||
//$this->PreSend();
|
||||
//$debugEml = $this->GetSentMIMEMessage().
|
||||
//print_a($debugEml);
|
||||
}
|
||||
|
||||
|
||||
$this->logLine("ArraySet Data:".print_r($eml,true));
|
||||
|
||||
@@ -854,15 +905,19 @@ class e107Email extends PHPMailer
|
||||
if (($this->logEnable == 0) || ($this->logEnable == 2))
|
||||
{
|
||||
// prevent user/script details being exposed in X-PHP-Script header
|
||||
$oldphpself = $_SERVER['PHP_SELF'];
|
||||
$oldremoteaddr = $_SERVER['REMOTE_ADDR'];
|
||||
$_SERVER['PHP_SELF'] = "/";
|
||||
$_SERVER['REMOTE_ADDR'] = $_SERVER['SERVER_ADDR'];
|
||||
$oldphpself = $_SERVER['PHP_SELF'];
|
||||
$oldremoteaddr = $_SERVER['REMOTE_ADDR'];
|
||||
$_SERVER['PHP_SELF'] = "/";
|
||||
$_SERVER['REMOTE_ADDR'] = $_SERVER['SERVER_ADDR'];
|
||||
$_SERVER["HTTP_X_FORWARDED_FOR"] = $_SERVER['SERVER_ADDR'];
|
||||
$_SERVER["HTTP_CF_CONNECTING_IP"] = $_SERVER['SERVER_ADDR'];
|
||||
|
||||
$result = $this->Send(); // Actually send email
|
||||
|
||||
$_SERVER['PHP_SELF'] = $oldphpself;
|
||||
$_SERVER['REMOTE_ADDR'] = $oldremoteaddr;
|
||||
$_SERVER["HTTP_X_FORWARDED_FOR"] = $oldremoteaddr;
|
||||
$_SERVER["HTTP_CF_CONNECTING_IP"] = $oldremoteaddr;
|
||||
|
||||
if (!$bulkmail && !$this->SMTPKeepAlive && ($this->Mailer == 'smtp')) $this->SmtpClose();
|
||||
}
|
||||
@@ -887,6 +942,11 @@ class e107Email extends PHPMailer
|
||||
if(!$result)
|
||||
{
|
||||
$this->logLine(print_r($eml,true));
|
||||
|
||||
if(!empty($eml['SMTPDebug']))
|
||||
{
|
||||
e107::getMessage()->addError($mail->ErrorInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1123,7 +1183,7 @@ function sendemail($send_to, $subject, $message, $to_name='', $send_from='', $fr
|
||||
|
||||
$identifier = deftrue('MAIL_IDENTIFIER', 'X-e107-id');
|
||||
|
||||
if (varsettrue($mailheader_e107id)) $mail->AddCustomHeader($identifier.": {$mailheader_e107id}");
|
||||
if (vartrue($mailheader_e107id)) $mail->AddCustomHeader($identifier.": {$mailheader_e107id}");
|
||||
|
||||
$mail->legacyBody = TRUE; // Need to handle plain text email conversion to HTML
|
||||
$mail->makeBody($message); // Add body, with conversion if required
|
||||
@@ -1145,10 +1205,10 @@ function sendemail($send_to, $subject, $message, $to_name='', $send_from='', $fr
|
||||
if ($inline) $mail->addInlineImages($inline);
|
||||
|
||||
// Passed parameter overrides any system default for bounce - but should this be 'ReplyTo' address instead?
|
||||
// if (varsettrue($returnpath)) $mail->Sender = $AddReplyToAddresses($returnpath,'');
|
||||
if (varsettrue($returnpath)) $mail->Sender = $returnpath;
|
||||
// if (vartrue($returnpath)) $mail->Sender = $AddReplyToAddresses($returnpath,'');
|
||||
if (vartrue($returnpath)) $mail->Sender = $returnpath;
|
||||
|
||||
if (varsettrue($returnreceipt)) $mail->ConfirmReadingTo($returnreceipt);
|
||||
if (vartrue($returnreceipt)) $mail->ConfirmReadingTo($returnreceipt);
|
||||
|
||||
if ($mail->sendEmail($send_to,$to_name) === TRUE)
|
||||
{ // Success
|
||||
|
49
e107_handlers/phpmailer/PHPMailerAutoload.php
Normal file
49
e107_handlers/phpmailer/PHPMailerAutoload.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPMailer SPL autoloader.
|
||||
* PHP Version 5
|
||||
* @package PHPMailer
|
||||
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
* @author Brent R. Matzelle (original founder)
|
||||
* @copyright 2012 - 2014 Marcus Bointon
|
||||
* @copyright 2010 - 2012 Jim Jagielski
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPMailer SPL autoloader.
|
||||
* @param string $classname The name of the class to load
|
||||
*/
|
||||
function PHPMailerAutoload($classname)
|
||||
{
|
||||
//Can't use __DIR__ as it's only in PHP 5.3+
|
||||
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
|
||||
if (is_readable($filename)) {
|
||||
require $filename;
|
||||
}
|
||||
}
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
|
||||
//SPL autoloading was introduced in PHP 5.1.2
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
||||
spl_autoload_register('PHPMailerAutoload', true, true);
|
||||
} else {
|
||||
spl_autoload_register('PHPMailerAutoload');
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
* Fall back to traditional autoload for old PHP versions
|
||||
* @param string $classname The name of the class to load
|
||||
*/
|
||||
function __autoload($classname)
|
||||
{
|
||||
PHPMailerAutoload($classname);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,418 +1,397 @@
|
||||
<?php
|
||||
/*~ class.pop3.php
|
||||
.---------------------------------------------------------------------------.
|
||||
| Software: PHPMailer - PHP email class |
|
||||
| Version: 5.2.2 |
|
||||
| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
|
||||
| ------------------------------------------------------------------------- |
|
||||
| Admin: Jim Jagielski (project admininistrator) |
|
||||
| Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
|
||||
| : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
|
||||
| : Jim Jagielski (jimjag) jimjag@gmail.com |
|
||||
| Founder: Brent R. Matzelle (original founder) |
|
||||
| Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved. |
|
||||
| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
|
||||
| Copyright (c) 2001-2003, Brent R. Matzelle |
|
||||
| ------------------------------------------------------------------------- |
|
||||
| License: Distributed under the Lesser General Public License (LGPL) |
|
||||
| http://www.gnu.org/copyleft/lesser.html |
|
||||
| This program is distributed in the hope that it will be useful - WITHOUT |
|
||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||
| FITNESS FOR A PARTICULAR PURPOSE. |
|
||||
'---------------------------------------------------------------------------'
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPMailer - PHP POP Before SMTP Authentication Class
|
||||
* NOTE: Designed for use with PHP version 5 and up
|
||||
* PHPMailer POP-Before-SMTP Authentication Class.
|
||||
* PHP Version 5
|
||||
* @package PHPMailer
|
||||
* @author Andy Prevost
|
||||
* @author Marcus Bointon
|
||||
* @author Jim Jagielski
|
||||
* @link https://github.com/PHPMailer/PHPMailer/
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
* @author Brent R. Matzelle (original founder)
|
||||
* @copyright 2012 - 2014 Marcus Bointon
|
||||
* @copyright 2010 - 2012 Jim Jagielski
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHP POP-Before-SMTP Authentication Class
|
||||
*
|
||||
* Version 5.2.2
|
||||
*
|
||||
* @license: LGPL, see PHPMailer License
|
||||
*
|
||||
* Specifically for PHPMailer to allow POP before SMTP authentication.
|
||||
* Does not yet work with APOP - if you have an APOP account, contact Jim Jagielski
|
||||
* and we can test changes to this script.
|
||||
*
|
||||
* This class is based on the structure of the SMTP class originally authored by Chris Ryan
|
||||
*
|
||||
* This class is rfc 1939 compliant and implements all the commands
|
||||
* required for POP3 connection, authentication and disconnection.
|
||||
*
|
||||
* PHPMailer POP-Before-SMTP Authentication Class.
|
||||
* Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
|
||||
* Does not support APOP.
|
||||
* @package PHPMailer
|
||||
* @author Richard Davey (orig) <rich@corephp.co.uk>
|
||||
* @author Andy Prevost
|
||||
* @author Jim Jagielski
|
||||
* @author Richard Davey (original author) <rich@corephp.co.uk>
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
*/
|
||||
class POP3
|
||||
{
|
||||
/**
|
||||
* The POP3 PHPMailer Version number.
|
||||
* @type string
|
||||
* @access public
|
||||
*/
|
||||
public $Version = '5.2.9';
|
||||
|
||||
class POP3 {
|
||||
/**
|
||||
* Default POP3 port
|
||||
* @var int
|
||||
*/
|
||||
public $POP3_PORT = 110;
|
||||
/**
|
||||
* Default POP3 port number.
|
||||
* @type integer
|
||||
* @access public
|
||||
*/
|
||||
public $POP3_PORT = 110;
|
||||
|
||||
/**
|
||||
* Default Timeout
|
||||
* @var int
|
||||
*/
|
||||
public $POP3_TIMEOUT = 30;
|
||||
/**
|
||||
* Default timeout in seconds.
|
||||
* @type integer
|
||||
* @access public
|
||||
*/
|
||||
public $POP3_TIMEOUT = 30;
|
||||
|
||||
/**
|
||||
* POP3 Carriage Return + Line Feed
|
||||
* @var string
|
||||
*/
|
||||
public $CRLF = "\r\n";
|
||||
/**
|
||||
* POP3 Carriage Return + Line Feed.
|
||||
* @type string
|
||||
* @access public
|
||||
* @deprecated Use the constant instead
|
||||
*/
|
||||
public $CRLF = "\r\n";
|
||||
|
||||
/**
|
||||
* Displaying Debug warnings? (0 = now, 1+ = yes)
|
||||
* @var int
|
||||
*/
|
||||
public $do_debug = 2;
|
||||
/**
|
||||
* Debug display level.
|
||||
* Options: 0 = no, 1+ = yes
|
||||
* @type integer
|
||||
* @access public
|
||||
*/
|
||||
public $do_debug = 0;
|
||||
|
||||
/**
|
||||
* POP3 Mail Server
|
||||
* @var string
|
||||
*/
|
||||
public $host;
|
||||
/**
|
||||
* POP3 mail server hostname.
|
||||
* @type string
|
||||
* @access public
|
||||
*/
|
||||
public $host;
|
||||
|
||||
/**
|
||||
* POP3 Port
|
||||
* @var int
|
||||
*/
|
||||
public $port;
|
||||
/**
|
||||
* POP3 port number.
|
||||
* @type integer
|
||||
* @access public
|
||||
*/
|
||||
public $port;
|
||||
|
||||
/**
|
||||
* POP3 Timeout Value
|
||||
* @var int
|
||||
*/
|
||||
public $tval;
|
||||
/**
|
||||
* POP3 Timeout Value in seconds.
|
||||
* @type integer
|
||||
* @access public
|
||||
*/
|
||||
public $tval;
|
||||
|
||||
/**
|
||||
* POP3 Username
|
||||
* @var string
|
||||
*/
|
||||
public $username;
|
||||
/**
|
||||
* POP3 username
|
||||
* @type string
|
||||
* @access public
|
||||
*/
|
||||
public $username;
|
||||
|
||||
/**
|
||||
* POP3 Password
|
||||
* @var string
|
||||
*/
|
||||
public $password;
|
||||
/**
|
||||
* POP3 password.
|
||||
* @type string
|
||||
* @access public
|
||||
*/
|
||||
public $password;
|
||||
|
||||
/**
|
||||
* Sets the POP3 PHPMailer Version number
|
||||
* @var string
|
||||
*/
|
||||
public $Version = '5.2.2';
|
||||
/**
|
||||
* Resource handle for the POP3 connection socket.
|
||||
* @type resource
|
||||
* @access private
|
||||
*/
|
||||
private $pop_conn;
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// PROPERTIES, PRIVATE AND PROTECTED
|
||||
/////////////////////////////////////////////////
|
||||
/**
|
||||
* Are we connected?
|
||||
* @type boolean
|
||||
* @access private
|
||||
*/
|
||||
private $connected = false;
|
||||
|
||||
/**
|
||||
* @var resource Resource handle for the POP connection socket
|
||||
*/
|
||||
private $pop_conn;
|
||||
/**
|
||||
* @var boolean Are we connected?
|
||||
*/
|
||||
private $connected;
|
||||
/**
|
||||
* @var array Error container
|
||||
*/
|
||||
private $error; // Error log array
|
||||
/**
|
||||
* Error container.
|
||||
* @type array
|
||||
* @access private
|
||||
*/
|
||||
private $errors = array();
|
||||
|
||||
/**
|
||||
* Constructor, sets the initial values
|
||||
* @access public
|
||||
* @return POP3
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->pop_conn = 0;
|
||||
$this->connected = false;
|
||||
$this->error = null;
|
||||
}
|
||||
/**
|
||||
* Line break constant
|
||||
*/
|
||||
const CRLF = "\r\n";
|
||||
|
||||
/**
|
||||
* Combination of public events - connect, login, disconnect
|
||||
* @access public
|
||||
* @param string $host
|
||||
* @param bool|int $port
|
||||
* @param bool|int $tval
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param int $debug_level
|
||||
* @return bool
|
||||
*/
|
||||
public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
|
||||
$this->host = $host;
|
||||
|
||||
// If no port value is passed, retrieve it
|
||||
if ($port == false) {
|
||||
$this->port = $this->POP3_PORT;
|
||||
} else {
|
||||
$this->port = $port;
|
||||
/**
|
||||
* Simple static wrapper for all-in-one POP before SMTP
|
||||
* @param $host
|
||||
* @param boolean $port
|
||||
* @param boolean $tval
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param integer $debug_level
|
||||
* @return boolean
|
||||
*/
|
||||
public static function popBeforeSmtp(
|
||||
$host,
|
||||
$port = false,
|
||||
$tval = false,
|
||||
$username = '',
|
||||
$password = '',
|
||||
$debug_level = 0
|
||||
) {
|
||||
$pop = new POP3;
|
||||
return $pop->authorise($host, $port, $tval, $username, $password, $debug_level);
|
||||
}
|
||||
|
||||
// If no port value is passed, retrieve it
|
||||
if ($tval == false) {
|
||||
$this->tval = $this->POP3_TIMEOUT;
|
||||
} else {
|
||||
$this->tval = $tval;
|
||||
/**
|
||||
* Authenticate with a POP3 server.
|
||||
* A connect, login, disconnect sequence
|
||||
* appropriate for POP-before SMTP authorisation.
|
||||
* @access public
|
||||
* @param string $host The hostname to connect to
|
||||
* @param integer|boolean $port The port number to connect to
|
||||
* @param integer|boolean $timeout The timeout value
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param integer $debug_level
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
|
||||
{
|
||||
$this->host = $host;
|
||||
// If no port value provided, use default
|
||||
if ($port === false) {
|
||||
$this->port = $this->POP3_PORT;
|
||||
} else {
|
||||
$this->port = (integer)$port;
|
||||
}
|
||||
// If no timeout value provided, use default
|
||||
if ($timeout === false) {
|
||||
$this->tval = $this->POP3_TIMEOUT;
|
||||
} else {
|
||||
$this->tval = (integer)$timeout;
|
||||
}
|
||||
$this->do_debug = $debug_level;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
// Reset the error log
|
||||
$this->errors = array();
|
||||
// connect
|
||||
$result = $this->connect($this->host, $this->port, $this->tval);
|
||||
if ($result) {
|
||||
$login_result = $this->login($this->username, $this->password);
|
||||
if ($login_result) {
|
||||
$this->disconnect();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// We need to disconnect regardless of whether the login succeeded
|
||||
$this->disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->do_debug = $debug_level;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
/**
|
||||
* Connect to a POP3 server.
|
||||
* @access public
|
||||
* @param string $host
|
||||
* @param integer|boolean $port
|
||||
* @param integer $tval
|
||||
* @return boolean
|
||||
*/
|
||||
public function connect($host, $port = false, $tval = 30)
|
||||
{
|
||||
// Are we already connected?
|
||||
if ($this->connected) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Refresh the error log
|
||||
$this->error = null;
|
||||
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
|
||||
//Rather than suppress it with @fsockopen, capture it cleanly instead
|
||||
set_error_handler(array($this, 'catchWarning'));
|
||||
|
||||
// Connect
|
||||
$result = $this->Connect($this->host, $this->port, $this->tval);
|
||||
if ($port === false) {
|
||||
$port = $this->POP3_PORT;
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$login_result = $this->Login($this->username, $this->password);
|
||||
// connect to the POP3 server
|
||||
$this->pop_conn = fsockopen(
|
||||
$host, // POP3 Host
|
||||
$port, // Port #
|
||||
$errno, // Error Number
|
||||
$errstr, // Error Message
|
||||
$tval
|
||||
); // Timeout (seconds)
|
||||
// Restore the error handler
|
||||
restore_error_handler();
|
||||
|
||||
if ($login_result) {
|
||||
$this->Disconnect();
|
||||
// Did we connect?
|
||||
if ($this->pop_conn === false) {
|
||||
// It would appear not...
|
||||
$this->setError(array(
|
||||
'error' => "Failed to connect to server $host on port $port",
|
||||
'errno' => $errno,
|
||||
'errstr' => $errstr
|
||||
));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// Increase the stream time-out
|
||||
stream_set_timeout($this->pop_conn, $tval, 0);
|
||||
|
||||
// Get the POP3 server response
|
||||
$pop3_response = $this->getResponse();
|
||||
// Check for the +OK
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
// The connection is established and the POP3 server is talking
|
||||
$this->connected = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// We need to disconnect regardless if the login succeeded
|
||||
$this->Disconnect();
|
||||
/**
|
||||
* Log in to the POP3 server.
|
||||
* Does not support APOP (RFC 2828, 4949).
|
||||
* @access public
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @return boolean
|
||||
*/
|
||||
public function login($username = '', $password = '')
|
||||
{
|
||||
if (!$this->connected) {
|
||||
$this->setError('Not connected to POP3 server');
|
||||
}
|
||||
if (empty($username)) {
|
||||
$username = $this->username;
|
||||
}
|
||||
if (empty($password)) {
|
||||
$password = $this->password;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to the POP3 server
|
||||
* @access public
|
||||
* @param string $host
|
||||
* @param bool|int $port
|
||||
* @param integer $tval
|
||||
* @return boolean
|
||||
*/
|
||||
public function Connect ($host, $port = false, $tval = 30) {
|
||||
// Are we already connected?
|
||||
if ($this->connected) {
|
||||
return true;
|
||||
// Send the Username
|
||||
$this->sendString("USER $username" . self::CRLF);
|
||||
$pop3_response = $this->getResponse();
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
// Send the Password
|
||||
$this->sendString("PASS $password" . self::CRLF);
|
||||
$pop3_response = $this->getResponse();
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
On Windows this will raise a PHP Warning error if the hostname doesn't exist.
|
||||
Rather than supress it with @fsockopen, let's capture it cleanly instead
|
||||
*/
|
||||
|
||||
set_error_handler(array(&$this, 'catchWarning'));
|
||||
|
||||
// Connect to the POP3 server
|
||||
$this->pop_conn = fsockopen($host, // POP3 Host
|
||||
$port, // Port #
|
||||
$errno, // Error Number
|
||||
$errstr, // Error Message
|
||||
$tval); // Timeout (seconds)
|
||||
|
||||
// Restore the error handler
|
||||
restore_error_handler();
|
||||
|
||||
// Does the Error Log now contain anything?
|
||||
if ($this->error && $this->do_debug >= 1) {
|
||||
$this->displayErrors();
|
||||
/**
|
||||
* Disconnect from the POP3 server.
|
||||
* @access public
|
||||
*/
|
||||
public function disconnect()
|
||||
{
|
||||
$this->sendString('QUIT');
|
||||
//The QUIT command may cause the daemon to exit, which will kill our connection
|
||||
//So ignore errors here
|
||||
try {
|
||||
@fclose($this->pop_conn);
|
||||
} catch (Exception $e) {
|
||||
//Do nothing
|
||||
};
|
||||
}
|
||||
|
||||
// Did we connect?
|
||||
if ($this->pop_conn == false) {
|
||||
// It would appear not...
|
||||
$this->error = array(
|
||||
'error' => "Failed to connect to server $host on port $port",
|
||||
'errno' => $errno,
|
||||
'errstr' => $errstr
|
||||
);
|
||||
|
||||
if ($this->do_debug >= 1) {
|
||||
$this->displayErrors();
|
||||
}
|
||||
|
||||
return false;
|
||||
/**
|
||||
* Get a response from the POP3 server.
|
||||
* $size is the maximum number of bytes to retrieve
|
||||
* @param integer $size
|
||||
* @return string
|
||||
* @access private
|
||||
*/
|
||||
private function getResponse($size = 128)
|
||||
{
|
||||
$response = fgets($this->pop_conn, $size);
|
||||
if ($this->do_debug >= 1) {
|
||||
echo "Server -> Client: $response";
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
// Increase the stream time-out
|
||||
|
||||
// Check for PHP 4.3.0 or later
|
||||
if (version_compare(phpversion(), '5.0.0', 'ge')) {
|
||||
stream_set_timeout($this->pop_conn, $tval, 0);
|
||||
} else {
|
||||
// Does not work on Windows
|
||||
if (substr(PHP_OS, 0, 3) !== 'WIN') {
|
||||
socket_set_timeout($this->pop_conn, $tval, 0);
|
||||
}
|
||||
/**
|
||||
* Send raw data to the POP3 server.
|
||||
* @param string $string
|
||||
* @return integer
|
||||
* @access private
|
||||
*/
|
||||
private function sendString($string)
|
||||
{
|
||||
if ($this->pop_conn) {
|
||||
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
|
||||
echo "Client -> Server: $string";
|
||||
}
|
||||
return fwrite($this->pop_conn, $string, strlen($string));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get the POP3 server response
|
||||
$pop3_response = $this->getResponse();
|
||||
|
||||
// Check for the +OK
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
// The connection is established and the POP3 server is talking
|
||||
$this->connected = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Login to the POP3 server (does not support APOP yet)
|
||||
* @access public
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @return boolean
|
||||
*/
|
||||
public function Login ($username = '', $password = '') {
|
||||
if ($this->connected == false) {
|
||||
$this->error = 'Not connected to POP3 server';
|
||||
|
||||
if ($this->do_debug >= 1) {
|
||||
$this->displayErrors();
|
||||
}
|
||||
/**
|
||||
* Checks the POP3 server response.
|
||||
* Looks for for +OK or -ERR.
|
||||
* @param string $string
|
||||
* @return boolean
|
||||
* @access private
|
||||
*/
|
||||
private function checkResponse($string)
|
||||
{
|
||||
if (substr($string, 0, 3) !== '+OK') {
|
||||
$this->setError(array(
|
||||
'error' => "Server reported an error: $string",
|
||||
'errno' => 0,
|
||||
'errstr' => ''
|
||||
));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($username)) {
|
||||
$username = $this->username;
|
||||
/**
|
||||
* Add an error to the internal error store.
|
||||
* Also display debug output if it's enabled.
|
||||
* @param $error
|
||||
*/
|
||||
private function setError($error)
|
||||
{
|
||||
$this->errors[] = $error;
|
||||
if ($this->do_debug >= 1) {
|
||||
echo '<pre>';
|
||||
foreach ($this->errors as $error) {
|
||||
print_r($error);
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($password)) {
|
||||
$password = $this->password;
|
||||
/**
|
||||
* POP3 connection error handler.
|
||||
* @param integer $errno
|
||||
* @param string $errstr
|
||||
* @param string $errfile
|
||||
* @param integer $errline
|
||||
* @access private
|
||||
*/
|
||||
private function catchWarning($errno, $errstr, $errfile, $errline)
|
||||
{
|
||||
$this->setError(array(
|
||||
'error' => "Connecting to the POP3 server raised a PHP warning: ",
|
||||
'errno' => $errno,
|
||||
'errstr' => $errstr,
|
||||
'errfile' => $errfile,
|
||||
'errline' => $errline
|
||||
));
|
||||
}
|
||||
|
||||
$pop_username = "USER $username" . $this->CRLF;
|
||||
$pop_password = "PASS $password" . $this->CRLF;
|
||||
|
||||
// Send the Username
|
||||
$this->sendString($pop_username);
|
||||
$pop3_response = $this->getResponse();
|
||||
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
// Send the Password
|
||||
$this->sendString($pop_password);
|
||||
$pop3_response = $this->getResponse();
|
||||
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from the POP3 server
|
||||
* @access public
|
||||
*/
|
||||
public function Disconnect () {
|
||||
$this->sendString('QUIT');
|
||||
|
||||
fclose($this->pop_conn);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// Private Methods
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Get the socket response back.
|
||||
* $size is the maximum number of bytes to retrieve
|
||||
* @access private
|
||||
* @param integer $size
|
||||
* @return string
|
||||
*/
|
||||
private function getResponse ($size = 128) {
|
||||
$pop3_response = fgets($this->pop_conn, $size);
|
||||
|
||||
return $pop3_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a string down the open socket connection to the POP3 server
|
||||
* @access private
|
||||
* @param string $string
|
||||
* @return integer
|
||||
*/
|
||||
private function sendString ($string) {
|
||||
$bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
|
||||
|
||||
return $bytes_sent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the POP3 server response for +OK or -ERR
|
||||
* @access private
|
||||
* @param string $string
|
||||
* @return boolean
|
||||
*/
|
||||
private function checkResponse ($string) {
|
||||
if (substr($string, 0, 3) !== '+OK') {
|
||||
$this->error = array(
|
||||
'error' => "Server reported an error: $string",
|
||||
'errno' => 0,
|
||||
'errstr' => ''
|
||||
);
|
||||
|
||||
if ($this->do_debug >= 1) {
|
||||
$this->displayErrors();
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* If debug is enabled, display the error message array
|
||||
* @access private
|
||||
*/
|
||||
private function displayErrors () {
|
||||
echo '<pre>';
|
||||
|
||||
foreach ($this->error as $single_error) {
|
||||
print_r($single_error);
|
||||
}
|
||||
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes over from PHP for the socket warning handler
|
||||
* @access private
|
||||
* @param integer $errno
|
||||
* @param string $errstr
|
||||
* @param string $errfile
|
||||
* @param integer $errline
|
||||
*/
|
||||
private function catchWarning ($errno, $errstr, $errfile, $errline) {
|
||||
$this->error[] = array(
|
||||
'error' => "Connecting to the POP3 server raised a PHP warning: ",
|
||||
'errno' => $errno,
|
||||
'errstr' => $errstr
|
||||
);
|
||||
}
|
||||
|
||||
// End of class
|
||||
}
|
||||
?>
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user