See changelog.
This commit is contained in:
parent
6763d1b6ed
commit
6720e98e10
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer - PHP email creation and transport class
|
||||
* PHP Version 5.0.0
|
||||
* @package PHPMailer
|
||||
* @link https://github.com/PHPMailer/PHPMailer/
|
||||
* @author Marcus Bointon (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 2013 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define an SPL autoloader for PHPMailer classes
|
||||
* @param string 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;
|
||||
}
|
||||
}
|
||||
|
||||
spl_autoload_register('PHPMailerAutoload');
|
||||
|
|
@ -32,6 +32,9 @@
|
|||
* Add unit tests for DKIM
|
||||
* Major refactor of SMTP class
|
||||
* Reformat to PSR-2 coding standard
|
||||
* Introduce autoloader
|
||||
* Allow overriding of SMTP class
|
||||
* Overhaul of PHPDocs
|
||||
|
||||
## Version 5.2.6 (April 11th 2013)
|
||||
* Reflect move to PHPMailer GitHub organisation at https://github.com/PHPMailer/PHPMailer
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
123
class.pop3.php
123
class.pop3.php
|
|
@ -1,14 +1,13 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer - PHP POP-Before-SMTP Authentication Class
|
||||
*
|
||||
* PHP Version 5.0.0
|
||||
*
|
||||
* Version 5.2.7
|
||||
* @package PHPMailer
|
||||
* @link https://github.com/PHPMailer/PHPMailer/
|
||||
* @author Marcus Bointon (coolbru) phpmailer@synchromedia.co.uk
|
||||
* @author Jim Jagielski (jimjag) jimjag@gmail.com
|
||||
* @author Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net
|
||||
* @author Marcus Bointon (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 2013 Marcus Bointon
|
||||
* @copyright 2010 - 2012 Jim Jagielski
|
||||
|
|
@ -20,96 +19,114 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* PHP POP-Before-SMTP Authentication Class
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* PHP 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 (coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
class POP3
|
||||
{
|
||||
/**
|
||||
* @var string The POP3 PHPMailer Version number
|
||||
* The POP3 PHPMailer Version number.
|
||||
* @type string
|
||||
* @access public
|
||||
*/
|
||||
public $Version = '5.2.6';
|
||||
public $Version = '5.2.7';
|
||||
|
||||
/**
|
||||
* @var int Default POP3 port number
|
||||
* Default POP3 port number.
|
||||
* @type int
|
||||
* @access public
|
||||
*/
|
||||
public $POP3_PORT = 110;
|
||||
|
||||
/**
|
||||
* @var int Default Timeout in seconds
|
||||
* Default timeout in seconds.
|
||||
* @type int
|
||||
* @access public
|
||||
*/
|
||||
public $POP3_TIMEOUT = 30;
|
||||
|
||||
/**
|
||||
* @var string POP3 Carriage Return + Line Feed
|
||||
* POP3 Carriage Return + Line Feed.
|
||||
* @type string
|
||||
* @access public
|
||||
*/
|
||||
public $CRLF = "\r\n";
|
||||
|
||||
/**
|
||||
* @var int Debug display level
|
||||
* Debug display level.
|
||||
* Options: 0 = no, 1+ = yes
|
||||
* @type int
|
||||
* @access public
|
||||
*/
|
||||
public $do_debug = 0;
|
||||
|
||||
/**
|
||||
* @var string POP3 mail Server
|
||||
* POP3 mail server hostname.
|
||||
* @type string
|
||||
* @access public
|
||||
*/
|
||||
public $host;
|
||||
|
||||
/**
|
||||
* @var int POP3 Port number
|
||||
* POP3 port number.
|
||||
* @type int
|
||||
* @access public
|
||||
*/
|
||||
public $port;
|
||||
|
||||
/**
|
||||
* @var int POP3 Timeout Value in seconds
|
||||
* POP3 Timeout Value in seconds.
|
||||
* @type int
|
||||
* @access public
|
||||
*/
|
||||
public $tval;
|
||||
|
||||
/**
|
||||
* @var string POP3 Username
|
||||
* POP3 username
|
||||
* @type string
|
||||
* @access public
|
||||
*/
|
||||
public $username;
|
||||
|
||||
/**
|
||||
* @var string POP3 Password
|
||||
* POP3 password.
|
||||
* @type string
|
||||
* @access public
|
||||
*/
|
||||
public $password;
|
||||
|
||||
/**
|
||||
* @var resource Resource handle for the POP connection socket
|
||||
* Resource handle for the POP3 connection socket.
|
||||
* @type resource
|
||||
* @access private
|
||||
*/
|
||||
private $pop_conn;
|
||||
|
||||
/**
|
||||
* @var bool Are we connected?
|
||||
* Are we connected?
|
||||
* @type bool
|
||||
* @access private
|
||||
*/
|
||||
private $connected;
|
||||
|
||||
/**
|
||||
* @var array Error container
|
||||
* Error container.
|
||||
* @type array
|
||||
* @access private
|
||||
*/
|
||||
private $error; // Error log array
|
||||
private $error;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
* @access public
|
||||
* @access private
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
|
@ -119,7 +136,9 @@ class POP3
|
|||
}
|
||||
|
||||
/**
|
||||
* Combination of public events - connect, login, disconnect
|
||||
* Authenticate with a POP3 server.
|
||||
* A connect, login, disconnect sequence
|
||||
* appropriate for POP-before SMTP authorisation.
|
||||
* @access public
|
||||
* @param string $host
|
||||
* @param bool|int $port
|
||||
|
|
@ -164,7 +183,7 @@ class POP3
|
|||
}
|
||||
|
||||
/**
|
||||
* Connect to the POP3 server
|
||||
* Connect to a POP3 server.
|
||||
* @access public
|
||||
* @param string $host
|
||||
* @param bool|int $port
|
||||
|
|
@ -180,7 +199,7 @@ class POP3
|
|||
|
||||
//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'));
|
||||
set_error_handler(array($this, 'catchWarning'));
|
||||
|
||||
// connect to the POP3 server
|
||||
$this->pop_conn = fsockopen(
|
||||
|
|
@ -233,7 +252,8 @@ class POP3
|
|||
}
|
||||
|
||||
/**
|
||||
* login to the POP3 server (does not support APOP yet)
|
||||
* Log in to the POP3 server.
|
||||
* Does not support APOP (RFC 2828, 4949).
|
||||
* @access public
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
|
|
@ -271,7 +291,7 @@ class POP3
|
|||
}
|
||||
|
||||
/**
|
||||
* disconnect from the POP3 server
|
||||
* Disconnect from the POP3 server.
|
||||
* @access public
|
||||
*/
|
||||
public function disconnect()
|
||||
|
|
@ -281,11 +301,11 @@ class POP3
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the socket response back.
|
||||
* Get a response from the POP3 server.
|
||||
* $size is the maximum number of bytes to retrieve
|
||||
* @access private
|
||||
* @param integer $size
|
||||
* @return string
|
||||
* @access private
|
||||
*/
|
||||
private function getResponse($size = 128)
|
||||
{
|
||||
|
|
@ -294,10 +314,10 @@ class POP3
|
|||
}
|
||||
|
||||
/**
|
||||
* send a string down the open socket connection to the POP3 server
|
||||
* @access private
|
||||
* Send raw data to the POP3 server.
|
||||
* @param string $string
|
||||
* @return integer
|
||||
* @access private
|
||||
*/
|
||||
private function sendString($string)
|
||||
{
|
||||
|
|
@ -306,10 +326,11 @@ class POP3
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks the POP3 server response for +OK or -ERR
|
||||
* @access private
|
||||
* Checks the POP3 server response.
|
||||
* Looks for for +OK or -ERR.
|
||||
* @param string $string
|
||||
* @return boolean
|
||||
* @access private
|
||||
*/
|
||||
private function checkResponse($string)
|
||||
{
|
||||
|
|
@ -329,7 +350,7 @@ class POP3
|
|||
}
|
||||
|
||||
/**
|
||||
* If debug is enabled, display the error message array
|
||||
* Display errors if debug is enabled.
|
||||
* @access private
|
||||
*/
|
||||
private function displayErrors()
|
||||
|
|
@ -342,12 +363,12 @@ class POP3
|
|||
}
|
||||
|
||||
/**
|
||||
* Takes over from PHP for the socket warning handler
|
||||
* @access private
|
||||
* 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)
|
||||
{
|
||||
|
|
|
|||
367
class.smtp.php
367
class.smtp.php
|
|
@ -1,27 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* SMTP email transport class
|
||||
* Version 5.2.6
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* SMTP email transport class.
|
||||
* Version 5.2.7
|
||||
* PHP version 5.0.0
|
||||
* @category PHP
|
||||
* @package PHPMailer
|
||||
* @link https://github.com/PHPMailer/PHPMailer/
|
||||
* @author Marcus Bointon (coolbru/Synchro) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
* @author Marcus Bointon (coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
* @copyright 2013 Marcus Bointon
|
||||
* @copyright 2004 - 2008 Andy Prevost
|
||||
* @copyright 2010 - 2012 Jim Jagielski
|
||||
* @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHP RFC821 SMTP email transport class
|
||||
* PHP RFC821 SMTP email transport class.
|
||||
*
|
||||
* Implements RFC 821 SMTP commands
|
||||
* (except TURN)
|
||||
* Also provides some utility methods for sending mail to an SMTP server.
|
||||
* and provides some utility methods for sending mail to an SMTP server.
|
||||
*
|
||||
* PHP Version 5.0.0
|
||||
*
|
||||
|
|
@ -36,73 +34,115 @@
|
|||
class SMTP
|
||||
{
|
||||
/**
|
||||
* @var string The SMTP PHPMailer Version number
|
||||
* The PHPMailer SMTP Version number.
|
||||
*/
|
||||
public $Version = '5.2.6';
|
||||
const VERSION = '5.2.7';
|
||||
|
||||
/**
|
||||
* @var int SMTP server port number
|
||||
*/
|
||||
public $SMTP_PORT = 25;
|
||||
|
||||
/**
|
||||
* @var string SMTP reply line ending (don't change)
|
||||
*/
|
||||
public $CRLF = "\r\n";
|
||||
|
||||
/**
|
||||
* @var int Debug output level; 0 for no output, 1 for commands, 2 for data and commands
|
||||
*/
|
||||
public $do_debug = 0;
|
||||
|
||||
/**
|
||||
* @var string The function/method to use for debugging output.
|
||||
* Options: 'echo', 'html' or 'error_log'
|
||||
*/
|
||||
public $Debugoutput = 'echo';
|
||||
|
||||
/**
|
||||
* @var bool Whether to use VERP.
|
||||
*/
|
||||
public $do_verp = false;
|
||||
|
||||
/**
|
||||
* @var int The SMTP timeout value for reads, in seconds
|
||||
*/
|
||||
public $Timeout = 15;
|
||||
|
||||
/**
|
||||
* @var int The SMTP timelimit value for reads, in seconds
|
||||
*/
|
||||
public $Timelimit = 30;
|
||||
|
||||
/**
|
||||
* @var resource The socket to the server
|
||||
*/
|
||||
protected $smtp_conn;
|
||||
|
||||
/**
|
||||
* @var string Error message, if any, for the last call
|
||||
*/
|
||||
protected $error = '';
|
||||
|
||||
/**
|
||||
* @var string The reply the server sent to us for HELO
|
||||
*/
|
||||
protected $helo_rply = '';
|
||||
|
||||
/**
|
||||
* @var string The most recent reply received form the server
|
||||
*/
|
||||
protected $last_reply = '';
|
||||
|
||||
/**
|
||||
* SMTP line break constant
|
||||
* SMTP line break constant.
|
||||
*/
|
||||
const CRLF = "\r\n";
|
||||
|
||||
/**
|
||||
* Outputs debugging info via user-defined method
|
||||
* The SMTP port to use if one is not specified.
|
||||
*/
|
||||
const DEFAULT_SMTP_PORT = 25;
|
||||
|
||||
/**
|
||||
* The PHPMailer SMTP Version number.
|
||||
* @type string
|
||||
* @deprecated This should be a constant
|
||||
* @see SMTP::VERSION
|
||||
*/
|
||||
public $Version = '5.2.7';
|
||||
|
||||
/**
|
||||
* SMTP server port number.
|
||||
* @type int
|
||||
* @deprecated This is only ever ued as default value, so should be a constant
|
||||
* @see SMTP::DEFAULT_SMTP_PORT
|
||||
*/
|
||||
public $SMTP_PORT = 25;
|
||||
|
||||
/**
|
||||
* SMTP reply line ending
|
||||
* @type string
|
||||
* @deprecated Use the class constant instead
|
||||
* @see SMTP::CRLF
|
||||
*/
|
||||
public $CRLF = "\r\n";
|
||||
|
||||
/**
|
||||
* Debug output level.
|
||||
* Options: 0 for no output, 1 for commands, 2 for data and commands
|
||||
* @type int
|
||||
*/
|
||||
public $do_debug = 0;
|
||||
|
||||
/**
|
||||
* The function/method to use for debugging output.
|
||||
* Options: 'echo', 'html' or 'error_log'
|
||||
* @type string
|
||||
*/
|
||||
public $Debugoutput = 'echo';
|
||||
|
||||
/**
|
||||
* Whether to use VERP.
|
||||
* @type bool
|
||||
*/
|
||||
public $do_verp = false;
|
||||
|
||||
/**
|
||||
* The SMTP timeout value for reads, in seconds.
|
||||
* @type int
|
||||
*/
|
||||
public $Timeout = 15;
|
||||
|
||||
/**
|
||||
* The SMTP timelimit value for reads, in seconds.
|
||||
* @type int
|
||||
*/
|
||||
public $Timelimit = 30;
|
||||
|
||||
/**
|
||||
* The socket for the server connection.
|
||||
* @type resource
|
||||
*/
|
||||
protected $smtp_conn;
|
||||
|
||||
/**
|
||||
* Error message, if any, for the last call.
|
||||
* @type string
|
||||
*/
|
||||
protected $error = '';
|
||||
|
||||
/**
|
||||
* The reply the server sent to us for HELO.
|
||||
* @type string
|
||||
*/
|
||||
protected $helo_rply = '';
|
||||
|
||||
/**
|
||||
* The most recent reply received from the server.
|
||||
* @type string
|
||||
*/
|
||||
protected $last_reply = '';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @access public
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->smtp_conn = 0;
|
||||
$this->error = null;
|
||||
$this->helo_rply = null;
|
||||
|
||||
$this->do_debug = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output debugging info via a user-selected method.
|
||||
* @param string $str Debug string to output
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -110,6 +150,7 @@ class SMTP
|
|||
{
|
||||
switch ($this->Debugoutput) {
|
||||
case 'error_log':
|
||||
//Don't output, just log
|
||||
error_log($str);
|
||||
break;
|
||||
case 'html':
|
||||
|
|
@ -123,26 +164,13 @@ class SMTP
|
|||
break;
|
||||
case 'echo':
|
||||
default:
|
||||
//Just echoes exactly what was received
|
||||
//Just echoes whatever was received
|
||||
echo $str;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the class so that the data is in a known state.
|
||||
* @access public
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->smtp_conn = 0;
|
||||
$this->error = null;
|
||||
$this->helo_rply = null;
|
||||
|
||||
$this->do_debug = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to an SMTP server
|
||||
* Connect to an SMTP server.
|
||||
* @param string $host SMTP server IP or host name
|
||||
* @param int $port The port number to connect to
|
||||
* @param int $timeout How long to wait for the connection to open
|
||||
|
|
@ -163,10 +191,10 @@ class SMTP
|
|||
}
|
||||
|
||||
if (empty($port)) {
|
||||
$port = $this->SMTP_PORT;
|
||||
$port = self::DEFAULT_SMTP_PORT;
|
||||
}
|
||||
|
||||
// connect to the SMTP server
|
||||
// Connect to the SMTP server
|
||||
$errno = 0;
|
||||
$errstr = '';
|
||||
$socket_context = stream_context_create($options);
|
||||
|
|
@ -180,7 +208,7 @@ class SMTP
|
|||
$socket_context
|
||||
);
|
||||
|
||||
// verify we connected properly
|
||||
// Verify we connected properly
|
||||
if (empty($this->smtp_conn)) {
|
||||
$this->error = array(
|
||||
'error' => 'Failed to connect to server',
|
||||
|
|
@ -206,7 +234,7 @@ class SMTP
|
|||
stream_set_timeout($this->smtp_conn, $timeout, 0);
|
||||
}
|
||||
|
||||
// get any announcement
|
||||
// Get any announcement
|
||||
$announce = $this->get_lines();
|
||||
|
||||
if ($this->do_debug >= 2) {
|
||||
|
|
@ -217,7 +245,7 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Initiate a TLS communication with the server.
|
||||
* Initiate a TLS (encrypted) session.
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
|
|
@ -239,8 +267,9 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Performs SMTP authentication.
|
||||
* Perform SMTP authentication.
|
||||
* Must be run after hello().
|
||||
* @see hello()
|
||||
* @param string $username The user name
|
||||
* @param string $password The password
|
||||
* @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5)
|
||||
|
|
@ -266,7 +295,7 @@ class SMTP
|
|||
if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
|
||||
return false;
|
||||
}
|
||||
// send encoded username and password
|
||||
// Send encoded username and password
|
||||
if (!$this->sendCommand(
|
||||
'User & Password',
|
||||
base64_encode("\0" . $username . "\0" . $password),
|
||||
|
|
@ -360,6 +389,7 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Calculate an MD5 HMAC hash.
|
||||
* Works like hash_hmac('md5', $data, $key)
|
||||
* in case that function is not available
|
||||
* @param string $data The data to hash
|
||||
|
|
@ -395,9 +425,9 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if connected to a server otherwise false
|
||||
* Check connection state.
|
||||
* @access public
|
||||
* @return bool
|
||||
* @return bool True if connected.
|
||||
*/
|
||||
public function connected()
|
||||
{
|
||||
|
|
@ -419,9 +449,9 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Closes the socket and cleans up the state of the class.
|
||||
* It is not considered good to use this function without
|
||||
* first trying to use QUIT.
|
||||
* Close the socket and clean up the state of the class.
|
||||
* Don't use this function without first trying to use QUIT.
|
||||
* @see quit()
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -437,7 +467,8 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Issues a data command and sends the msg_data to the server
|
||||
* Send an SMTP DATA command.
|
||||
* Issues a data command and sends the msg_data to the server,
|
||||
* finializing the mail transaction. $msg_data is the message
|
||||
* 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
|
||||
|
|
@ -464,7 +495,7 @@ class SMTP
|
|||
* line. NOTE: this does not count towards limit.
|
||||
*/
|
||||
|
||||
// Normalize the line breaks so we know the explode works
|
||||
// Normalize the line breaks before exploding
|
||||
$msg_data = str_replace("\r\n", "\n", $msg_data);
|
||||
$msg_data = str_replace("\r", "\n", $msg_data);
|
||||
$lines = explode("\n", $msg_data);
|
||||
|
|
@ -531,10 +562,11 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Sends the HELO command to the smtp server.
|
||||
* This makes sure that we and the server are in
|
||||
* the same known state.
|
||||
* Implements from rfc 821: HELO <SP> <domain> <CRLF>
|
||||
* Send an SMTP HELO or EHLO command.
|
||||
* Used to identify the sending server to the receiving server.
|
||||
* This makes sure that client and server are in a known state.
|
||||
* Implements from RFC 821: HELO <SP> <domain> <CRLF>
|
||||
* and RFC 2821 EHLO.
|
||||
* @param string $host The host name or IP to connect to
|
||||
* @access public
|
||||
* @return bool
|
||||
|
|
@ -552,7 +584,9 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Sends a HELO/EHLO command.
|
||||
* Send an SMTP HELO or EHLO command.
|
||||
* Low-level implementation used by hello()
|
||||
* @see hello()
|
||||
* @param string $hello The HELO string
|
||||
* @param string $host The hostname to say we are
|
||||
* @access protected
|
||||
|
|
@ -566,6 +600,7 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Send an SMTP MAIL command.
|
||||
* Starts a mail transaction from the email address specified in
|
||||
* $from. Returns true if successful or false otherwise. If True
|
||||
* the mail transaction is started and then one or more recipient
|
||||
|
|
@ -586,8 +621,8 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Sends the quit command to the server and then closes the socket
|
||||
* if there is no error or the $close_on_error argument is true.
|
||||
* Send an SMTP QUIT command.
|
||||
* Closes the socket if there is no error or the $close_on_error argument is true.
|
||||
* Implements from rfc 821: QUIT <CRLF>
|
||||
* @param bool $close_on_error Should the connection close if an error occurs?
|
||||
* @access public
|
||||
|
|
@ -605,7 +640,8 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Sends the command RCPT to the SMTP server with the TO: argument of $to.
|
||||
* Send an SMTP RCPT command.
|
||||
* Sets the TO argument to $to.
|
||||
* Returns true if the recipient was accepted false if it was rejected.
|
||||
* Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
|
||||
* @param string $to The address the message is being sent to
|
||||
|
|
@ -622,12 +658,11 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Sends the RSET command to abort and transaction that is
|
||||
* currently in progress. Returns true if successful false
|
||||
* otherwise.
|
||||
* Send an SMTP RSET command.
|
||||
* Abort any transaction that is currently in progress.
|
||||
* Implements rfc 821: RSET <CRLF>
|
||||
* @access public
|
||||
* @return bool
|
||||
* @return bool True on success.
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
|
|
@ -635,12 +670,12 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Send a command to an SMTP server and check its return code
|
||||
* Send a command to an SMTP server and check its return code.
|
||||
* @param string $command The command name - not sent to the server
|
||||
* @param string $commandstring The actual command to send
|
||||
* @param int|array $expect One or more expected integer success codes
|
||||
* @param int|array $expect One or more expected integer success codes
|
||||
* @access protected
|
||||
* @return bool
|
||||
* @return bool True on success.
|
||||
*/
|
||||
protected function sendCommand($command, $commandstring, $expect)
|
||||
{
|
||||
|
|
@ -680,8 +715,9 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Starts a mail transaction from the email address specified in
|
||||
* $from. Returns true if successful or false otherwise. If True
|
||||
* Send an SMTP SAML command.
|
||||
* Starts a mail transaction from the email address specified in $from.
|
||||
* Returns true if successful or false otherwise. If True
|
||||
* the mail transaction is started and then one or more recipient
|
||||
* commands may be called followed by a data command. This command
|
||||
* will send the message to the users terminal if they are logged
|
||||
|
|
@ -697,10 +733,8 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Issue a verify command
|
||||
*
|
||||
* Send an SMTP VRFY command.
|
||||
* @param string $name The name to verify
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
|
|
@ -710,7 +744,7 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Issue a No-op command
|
||||
* Send an SMTP NOOP command.
|
||||
* Used to keep keep-alives alive, doesn't actually do anything
|
||||
* @access public
|
||||
* @return bool
|
||||
|
|
@ -721,9 +755,10 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* This is an optional command for SMTP that this class does not
|
||||
* support. This method is here to make the RFC821 Definition
|
||||
* complete for this class and __may__ be implimented in the future
|
||||
* Send an SMTP TURN command.
|
||||
* This is an optional command for SMTP that this class does not support.
|
||||
* This method is here to make the RFC821 Definition
|
||||
* complete for this class and __may__ be implemented in future
|
||||
* Implements from rfc 821: TURN <CRLF>
|
||||
* @access public
|
||||
* @return bool
|
||||
|
|
@ -740,10 +775,10 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Sends data to the server
|
||||
* Send raw data to the server.
|
||||
* @param string $data The data to send
|
||||
* @access public
|
||||
* @return Integer number of bytes sent to the server or FALSE on error
|
||||
* @return int|bool The number of bytes sent to the server or FALSE on error
|
||||
*/
|
||||
public function client_send($data)
|
||||
{
|
||||
|
|
@ -754,7 +789,7 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the latest error
|
||||
* Get the latest error.
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -764,7 +799,7 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the last reply from the server
|
||||
* Get the last reply from the server.
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -774,8 +809,8 @@ class SMTP
|
|||
}
|
||||
|
||||
/**
|
||||
* Read in as many lines as possible
|
||||
* either before eof or socket timeout occurs on the operation.
|
||||
* Read the SMTP server's response.
|
||||
* Either before eof or socket timeout occurs on the operation.
|
||||
* With SMTP we can tell if we have more lines to read if the
|
||||
* 4th character is '-' symbol. If it is a space then we don't
|
||||
* need to read anything else.
|
||||
|
|
@ -833,4 +868,76 @@ class SMTP
|
|||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable VERP address generation.
|
||||
* @param bool $enabled
|
||||
*/
|
||||
public function setVerp($enabled = false)
|
||||
{
|
||||
$this->do_verp = $enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get VERP address generation mode.
|
||||
* @return bool
|
||||
*/
|
||||
public function getVerp()
|
||||
{
|
||||
return $this->do_verp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set debug output method.
|
||||
* @param string $method The function/method to use for debugging output.
|
||||
*/
|
||||
public function setDebugOutput($method = 'echo')
|
||||
{
|
||||
$this->Debugoutput = $method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get debug output method.
|
||||
* @return string
|
||||
*/
|
||||
public function getDebugOutput()
|
||||
{
|
||||
return $this->Debugoutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set debug output level.
|
||||
* @param int $level
|
||||
*/
|
||||
public function setDebugLevel($level = 0)
|
||||
{
|
||||
$this->do_debug = $level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get debug output level.
|
||||
* @return int
|
||||
*/
|
||||
public function getDebugLevel()
|
||||
{
|
||||
return $this->do_debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set SMTP timeout.
|
||||
* @param int $timeout
|
||||
*/
|
||||
public function setTimeout($timeout = 0)
|
||||
{
|
||||
$this->Timeout = $timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SMTP timeout.
|
||||
* @return int
|
||||
*/
|
||||
public function getTimeout()
|
||||
{
|
||||
return $this->Timeout;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/sh
|
||||
# Regenerate PHPMailer documentation
|
||||
# Run from within the docs folder
|
||||
rm -rf phpdocs/*
|
||||
phpdoc --directory .. --target ./phpdoc --ignore test/,examples/,extras/,test_script/ --sourcecode --force --title PHPMailer
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* revised, updated and corrected 27/02/2013
|
||||
* by matt.sturdy@gmail.com
|
||||
*/
|
||||
require '../class.phpmailer.php';
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
$CFG['smtp_debug'] = 2; //0 == off, 1 for client output, 2 for client and server
|
||||
$CFG['smtp_debugoutput'] = 'html';
|
||||
|
|
@ -39,7 +39,7 @@ $results_messages = array();
|
|||
|
||||
// $example_code represents the "final code" that we're using, and will
|
||||
// be shown to the user at the end.
|
||||
$example_code = "\nrequire_once '../class.phpmailer.php';";
|
||||
$example_code = "\nrequire_once '../PHPMailerAutoload.php';";
|
||||
$example_code .= "\n\n\$results_messages = array();";
|
||||
|
||||
$mail = new PHPMailer(true); //PHPMailer instance with exceptions enabled
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require '../class.phpmailer.php';
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
//Passing true to the constructor enables the use of exceptions for error handling
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
//This should be done in your php.ini, but this is how to do it if you don't have access to that
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
|
||||
require '../class.phpmailer.php';
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require '../class.phpmailer.php';
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ error_reporting(E_STRICT | E_ALL);
|
|||
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
|
||||
require '../class.phpmailer.php';
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
$mail = new PHPMailer();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require '../class.phpmailer.php';
|
||||
require '../class.pop3.php';
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new POP client instance
|
||||
$pop = new POP3();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require '../class.phpmailer.php';
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
//This should be done in your php.ini, but this is how to do it if you don't have access to that
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
|
||||
require '../class.phpmailer.php';
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
//This should be done in your php.ini, but this is how to do it if you don't have access to that
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
|
||||
require_once '../class.phpmailer.php';
|
||||
require_once '../PHPMailerAutoload.php';
|
||||
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer();
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
require 'PHPUnit/Autoload.php';
|
||||
require '../PHPMailerAutoload.php';
|
||||
|
||||
/**
|
||||
* PHPMailer - PHP email transport unit test class
|
||||
|
|
@ -64,7 +65,7 @@ class PHPMailerTest extends PHPUnit_Framework_TestCase
|
|||
if (file_exists('./testbootstrap.php')) {
|
||||
include './testbootstrap.php'; //Overrides go in here
|
||||
}
|
||||
require_once $this->INCLUDE_DIR . 'class.phpmailer.php';
|
||||
//require_once $this->INCLUDE_DIR . 'class.phpmailer.php';
|
||||
$this->Mail = new PHPMailer;
|
||||
|
||||
$this->Mail->Priority = 3;
|
||||
|
|
|
|||
Loading…
Reference in New Issue