Vergleich inc/mailhandlers/smtp.php - 1.6.5 - 1.6.18

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: smtp.php 5297 2010-12-28 22:01:14Z Tomm $

 * $Id$

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 128Zeile 128
	 * @var boolean
*/
public $keep_alive = false;

	 * @var boolean
*/
public $keep_alive = false;

 

/**
* Whether to use TLS encryption.
*
* @var boolean
*/
public $use_tls = false;


function __construct()
{


function __construct()
{

Zeile 138Zeile 145
		{
case MYBB_SSL:
$protocol = 'ssl://';

		{
case MYBB_SSL:
$protocol = 'ssl://';

				break;

				break;

			case MYBB_TLS:

			case MYBB_TLS:

				$protocol = 'tls://';

				$this->use_tls = true;

				break;
}

if(empty($mybb->settings['smtp_host']))
{
$this->host = @ini_get('SMTP');

				break;
}

if(empty($mybb->settings['smtp_host']))
{
$this->host = @ini_get('SMTP');

		}
else
{

		}
else
{

			$this->host = $mybb->settings['smtp_host'];
}

			$this->host = $mybb->settings['smtp_host'];
}

		
$this->helo = $this->host;





















$local = array('127.0.0.1', '::1', 'localhost');
if(!in_array($this->host, $local))
{
if(function_exists('gethostname') && gethostname() !== false)
{
$this->helo = gethostname();
}
elseif(function_exists('php_uname'))
{
$helo = php_uname('n');
if(!empty($helo))
{
$this->helo = $helo;
}
}
elseif(!empty($_SERVER['SERVER_NAME']))
{
$this->helo = $_SERVER['SERVER_NAME'];
}
}


$this->host = $protocol . $this->host;



$this->host = $protocol . $this->host;


Zeile 185Zeile 211

if(!$this->connected())
{


if(!$this->connected())
{

			$this->connect();




			if(!$this->connect())
{
$this->close();
}

		}

if($this->connected())

		}

if($this->connected())

		{

		{

			if(!$this->send_data('MAIL FROM:<'.$this->from.'>', '250'))
{
$this->fatal_error("The mail server does not understand the MAIL FROM command. Reason: ".$this->get_error());

			if(!$this->send_data('MAIL FROM:<'.$this->from.'>', '250'))
{
$this->fatal_error("The mail server does not understand the MAIL FROM command. Reason: ".$this->get_error());

Zeile 226Zeile 255
				// Queue the actual message
$this->message = str_replace("\n.", "\n..", $this->message);
$this->send_data($this->message);

				// Queue the actual message
$this->message = str_replace("\n.", "\n..", $this->message);
$this->send_data($this->message);

			}
else
{

			}
else
{

				$this->fatal_error("The mail server did not understand the DATA command");
return false;
}

				$this->fatal_error("The mail server did not understand the DATA command");
return false;
}

Zeile 274Zeile 303
				return false;
}


				return false;
}


			if(!empty($this->username) && !empty($this->password))

















			if($this->use_tls || (!empty($this->username) && !empty($this->password)))
{
$helo = 'EHLO';
}
else
{
$helo = 'HELO';
}

$data = $this->send_data("{$helo} {$this->helo}", '250');
if(!$data)
{
$this->fatal_error("The server did not understand the {$helo} command");
return false;
}

if($this->use_tls && preg_match("#250( |-)STARTTLS#mi", $data))

			{

			{

				$data = $this->send_data('EHLO ' . $this->helo, '250');












				if(!$this->send_data('STARTTLS', '220'))
{
$this->fatal_error("The server did not understand the STARTTLS command. Reason: ".$this->get_error());
return false;
}
if(!@stream_socket_enable_crypto($this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT))
{
$this->fatal_error("Failed to start TLS encryption");
return false;
}
// Resend EHLO to get updated service list
$data = $this->send_data("{$helo} {$this->helo}", '250');

				if(!$data)
{
$this->fatal_error("The server did not understand the EHLO command");

				if(!$data)
{
$this->fatal_error("The server did not understand the EHLO command");

					return false;
}
preg_match("#250-AUTH( |=)(.+)$#mi", $data, $matches);
if(!$this->auth($matches[2]))
{
$this->fatal_error("MyBB was unable to authenticate you against the SMTP server");

 
					return false;
}
}

					return false;
}
}

			else



if(!empty($this->username) && !empty($this->password))

			{

			{

				if(!$this->send_data('HELO ' . $this->helo, '250'))


				preg_match("#250( |-)AUTH( |=)(.+)$#mi", $data, $matches);
if(!$this->auth($matches[3]))

				{

				{

					$this->fatal_error("The server did not understand the HELO command");

 
					return false;
}
}

					return false;
}
}

Zeile 301Zeile 352
		}
else
{

		}
else
{

			$this->fatal_error("Unable to connect to the mail server with the given details.<br /><br />{$error_number}: {$error_string}");

			$this->fatal_error("Unable to connect to the mail server with the given details. Reason: {$error_number}: {$error_string}");

			return false;
}
}

			return false;
}
}

Zeile 316Zeile 367
	{
global $lang, $mybb;


	{
global $lang, $mybb;


		$auth_methods = explode(" ", $auth_methods);

		$auth_methods = explode(" ", trim($auth_methods));

		
if(in_array("LOGIN", $auth_methods))
{

		
if(in_array("LOGIN", $auth_methods))
{

Zeile 387Zeile 438
				break;
}
}

				break;
}
}

 
		$string = trim($string);

		$this->data = $string;

		$this->data = $string;

		$this->code = substr(trim($this->data), 0, 3);

		$this->code = substr($this->data, 0, 3);

		return $string;
}


		return $string;
}