mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
Bugtracker #4082 - upgrade PHPMailer to V2.0.0
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,66 +1,115 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*~ class.pop3.php
|
||||||
POP Before SMTP Authentication Class
|
.---------------------------------------------------------------------------.
|
||||||
Version 1.0
|
| Software: PHPMailer - PHP email class |
|
||||||
|
| Version: 2.0.0 rc2 |
|
||||||
|
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
|
||||||
|
| Info: http://phpmailer.sourceforge.net |
|
||||||
|
| Support: http://sourceforge.net/projects/phpmailer/ |
|
||||||
|
| ------------------------------------------------------------------------- |
|
||||||
|
| Author: Andy Prevost (project admininistrator) |
|
||||||
|
| Author: Brent R. Matzelle (original founder) |
|
||||||
|
| Copyright (c) 2004-2007, 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. |
|
||||||
|
| ------------------------------------------------------------------------- |
|
||||||
|
| We offer a number of paid services (www.codeworxtech.com): |
|
||||||
|
| - Web Hosting on highly optimized fast and secure servers |
|
||||||
|
| - Technology Consulting |
|
||||||
|
| - Oursourcing (highly qualified programmers and graphic designers) |
|
||||||
|
'---------------------------------------------------------------------------'
|
||||||
|
|
||||||
Author: Richard Davey (rich@corephp.co.uk)
|
/**
|
||||||
License: LGPL, see PHPMailer License
|
* POP Before SMTP Authentication Class
|
||||||
|
* Version 1.0
|
||||||
Specifically for PHPMailer to allow POP before SMTP authentication.
|
*
|
||||||
Does not yet work with APOP - if you have an APOP account, contact me
|
* Author: Richard Davey (rich@corephp.co.uk)
|
||||||
and we can test changes to this script.
|
* License: LGPL, see PHPMailer License
|
||||||
|
*
|
||||||
This class is based on the structure of the SMTP class by Chris Ryan
|
* Specifically for PHPMailer to allow POP before SMTP authentication.
|
||||||
|
* Does not yet work with APOP - if you have an APOP account, contact me
|
||||||
This class is rfc 1939 compliant and implements all the commands
|
* and we can test changes to this script.
|
||||||
required for POP3 connection, authentication and disconnection.
|
*
|
||||||
|
* This class is based on the structure of the SMTP class by Chris Ryan
|
||||||
@package PHPMailer
|
*
|
||||||
@author Richard Davey
|
* This class is rfc 1939 compliant and implements all the commands
|
||||||
|
* required for POP3 connection, authentication and disconnection.
|
||||||
|
*
|
||||||
|
* @package PHPMailer
|
||||||
|
* @author Richard Davey
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class POP3
|
class POP3
|
||||||
{
|
{
|
||||||
// Default POP3 port
|
/**
|
||||||
|
* Default POP3 port
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
var $POP3_PORT = 110;
|
var $POP3_PORT = 110;
|
||||||
|
|
||||||
// Default Timeout
|
/**
|
||||||
|
* Default Timeout
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
var $POP3_TIMEOUT = 30;
|
var $POP3_TIMEOUT = 30;
|
||||||
|
|
||||||
// Carriage Return + Line Feed
|
/**
|
||||||
|
* POP3 Carriage Return + Line Feed
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
var $CRLF = "\r\n";
|
var $CRLF = "\r\n";
|
||||||
|
|
||||||
// Displaying Debug warnings? (0 = now, 1+ = yes)
|
/**
|
||||||
|
* Displaying Debug warnings? (0 = now, 1+ = yes)
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
var $do_debug = 2;
|
var $do_debug = 2;
|
||||||
|
|
||||||
// Socket connection resource handle
|
/**
|
||||||
var $pop_conn;
|
* POP3 Mail Server
|
||||||
|
* @var string
|
||||||
// Boolean state of connection
|
*/
|
||||||
var $connected;
|
|
||||||
|
|
||||||
// Error log array
|
|
||||||
var $error;
|
|
||||||
|
|
||||||
// POP3 Server Connection Required values
|
|
||||||
|
|
||||||
// Mail Server
|
|
||||||
var $host;
|
var $host;
|
||||||
|
|
||||||
// Port
|
/**
|
||||||
|
* POP3 Port
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
var $port;
|
var $port;
|
||||||
|
|
||||||
// Timeout Value
|
/**
|
||||||
|
* POP3 Timeout Value
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
var $tval;
|
var $tval;
|
||||||
|
|
||||||
// POP3 Username
|
/**
|
||||||
|
* POP3 Username
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
var $username;
|
var $username;
|
||||||
|
|
||||||
// POP3 Password
|
/**
|
||||||
|
* POP3 Password
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
var $password;
|
var $password;
|
||||||
|
|
||||||
|
/**#@+
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
var $pop_conn;
|
||||||
|
var $connected;
|
||||||
|
var $error; // Error log array
|
||||||
|
/**#@-*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Our constructor, sets the initial values
|
* Constructor, sets the initial values
|
||||||
*
|
*
|
||||||
* @return POP3
|
* @return POP3
|
||||||
*/
|
*/
|
||||||
@@ -278,7 +327,6 @@ class POP3
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Disconnect from the POP3 server
|
* Disconnect from the POP3 server
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function Disconnect ()
|
function Disconnect ()
|
||||||
{
|
{
|
||||||
|
@@ -1,17 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
////////////////////////////////////////////////////
|
/*~ class.smtp.php
|
||||||
// SMTP - PHP SMTP class
|
.---------------------------------------------------------------------------.
|
||||||
//
|
| Software: PHPMailer - PHP email class |
|
||||||
// Version 1.02
|
| Version: 2.0.0 rc1 |
|
||||||
//
|
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
|
||||||
// Define an SMTP class that can be used to connect
|
| Info: http://phpmailer.sourceforge.net |
|
||||||
// and communicate with any SMTP server. It implements
|
| Support: http://sourceforge.net/projects/phpmailer/ |
|
||||||
// all the SMTP functions defined in RFC821 except TURN.
|
| ------------------------------------------------------------------------- |
|
||||||
//
|
| Author: Andy Prevost (project admininistrator) |
|
||||||
// Author: Chris Ryan
|
| Author: Brent R. Matzelle (original founder) |
|
||||||
//
|
| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
|
||||||
// License: LGPL, see LICENSE
|
| 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. |
|
||||||
|
| ------------------------------------------------------------------------- |
|
||||||
|
| We offer a number of paid services (www.codeworxtech.com): |
|
||||||
|
| - Web Hosting on highly optimized fast and secure servers |
|
||||||
|
| - Technology Consulting |
|
||||||
|
| - Oursourcing (highly qualified programmers and graphic designers) |
|
||||||
|
'---------------------------------------------------------------------------'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
|
* SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
|
||||||
@@ -21,6 +32,7 @@
|
|||||||
* @package PHPMailer
|
* @package PHPMailer
|
||||||
* @author Chris Ryan
|
* @author Chris Ryan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class SMTP
|
class SMTP
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -41,6 +53,12 @@ class SMTP
|
|||||||
*/
|
*/
|
||||||
var $do_debug; # the level of debug to perform
|
var $do_debug; # the level of debug to perform
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets VERP use on/off (default is off)
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
var $do_verp = false;
|
||||||
|
|
||||||
/**#@+
|
/**#@+
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
@@ -88,8 +106,7 @@ class SMTP
|
|||||||
# ok we are connected! what should we do?
|
# ok we are connected! what should we do?
|
||||||
# for now we will just give an error saying we
|
# for now we will just give an error saying we
|
||||||
# are already connected
|
# are already connected
|
||||||
$this->error =
|
$this->error = array("error" => "Already connected to a server");
|
||||||
array("error" => "Already connected to a server");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +226,7 @@ class SMTP
|
|||||||
$sock_status = socket_get_status($this->smtp_conn);
|
$sock_status = socket_get_status($this->smtp_conn);
|
||||||
if($sock_status["eof"]) {
|
if($sock_status["eof"]) {
|
||||||
# hmm this is an odd situation... the socket is
|
# hmm this is an odd situation... the socket is
|
||||||
# valid but we aren't connected anymore
|
# valid but we are not connected anymore
|
||||||
if($this->do_debug >= 1) {
|
if($this->do_debug >= 1) {
|
||||||
echo "SMTP -> NOTICE:" . $this->CRLF .
|
echo "SMTP -> NOTICE:" . $this->CRLF .
|
||||||
"EOF caught while checking if connected";
|
"EOF caught while checking if connected";
|
||||||
@@ -239,7 +256,6 @@ class SMTP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
* SMTP COMMANDS *
|
* SMTP COMMANDS *
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
@@ -249,7 +265,7 @@ class SMTP
|
|||||||
* finializing the mail transaction. $msg_data is the message
|
* finializing the mail transaction. $msg_data is the message
|
||||||
* that is to be send with the headers. Each header needs to be
|
* that is to be send with the headers. Each header needs to be
|
||||||
* on a single line followed by a <CRLF> with the message headers
|
* on a single line followed by a <CRLF> with the message headers
|
||||||
* and the message body being separated by and additional <CRLF>.
|
* and the message body being seperated by and additional <CRLF>.
|
||||||
*
|
*
|
||||||
* Implements rfc 821: DATA <CRLF>
|
* Implements rfc 821: DATA <CRLF>
|
||||||
*
|
*
|
||||||
@@ -310,7 +326,7 @@ class SMTP
|
|||||||
|
|
||||||
# we need to find a good way to determine is headers are
|
# we need to find a good way to determine is headers are
|
||||||
# in the msg_data or if it is a straight msg body
|
# in the msg_data or if it is a straight msg body
|
||||||
# currently I'm assuming rfc 822 definitions of msg headers
|
# currently I am assuming rfc 822 definitions of msg headers
|
||||||
# and if the first field of the first line (':' sperated)
|
# and if the first field of the first line (':' sperated)
|
||||||
# does not contain a space then it _should_ be a header
|
# does not contain a space then it _should_ be a header
|
||||||
# and we can process all lines before a blank "" line as
|
# and we can process all lines before a blank "" line as
|
||||||
@@ -462,7 +478,7 @@ class SMTP
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
# if a hostname for the HELO wasn't specified determine
|
# if a hostname for the HELO was not specified determine
|
||||||
# a suitable one to send
|
# a suitable one to send
|
||||||
if(empty($host)) {
|
if(empty($host)) {
|
||||||
# we need to determine some sort of appopiate default
|
# we need to determine some sort of appopiate default
|
||||||
@@ -588,7 +604,8 @@ class SMTP
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $this->CRLF);
|
$useVerp = ($this->do_verp ? "XVERP" : "");
|
||||||
|
fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
|
||||||
|
|
||||||
$rply = $this->get_lines();
|
$rply = $this->get_lines();
|
||||||
$code = substr($rply,0,3);
|
$code = substr($rply,0,3);
|
||||||
@@ -1021,7 +1038,7 @@ class SMTP
|
|||||||
*/
|
*/
|
||||||
function get_lines() {
|
function get_lines() {
|
||||||
$data = "";
|
$data = "";
|
||||||
while($str = fgets($this->smtp_conn,515)) {
|
while($str = @fgets($this->smtp_conn,515)) {
|
||||||
if($this->do_debug >= 4) {
|
if($this->do_debug >= 4) {
|
||||||
echo "SMTP -> get_lines(): \$data was \"$data\"" .
|
echo "SMTP -> get_lines(): \$data was \"$data\"" .
|
||||||
$this->CRLF;
|
$this->CRLF;
|
||||||
|
Reference in New Issue
Block a user