Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: smtp.php 4053 2008-07-31 04:56:19Z Tikitiki $
| * $Id: smtp.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 114 | Zeile 114 |
---|
* @var string */ var $code = 0;
|
* @var string */ var $code = 0;
|
| /** * The last received error message from the SMTP server. * * @var string */ var $last_error = '';
|
/** * Are we keeping the connection to the SMTP server alive?
| /** * Are we keeping the connection to the SMTP server alive?
|
Zeile 121 | Zeile 128 |
---|
* @var boolean */ var $keep_alive = false;
|
* @var boolean */ var $keep_alive = false;
|
function SmtpMail()
| function SmtpMail()
|
{ global $mybb;
|
{ global $mybb;
|
|
|
$this->__construct();
|
$this->__construct();
|
}
| }
|
function __construct() { global $mybb;
| function __construct() { global $mybb;
|
Zeile 138 | Zeile 145 |
---|
{ case MYBB_SSL: $protocol = 'ssl://';
|
{ case MYBB_SSL: $protocol = 'ssl://';
|
break;
| break;
|
case MYBB_TLS: $protocol = 'tls://'; break;
| case MYBB_TLS: $protocol = 'tls://'; break;
|
Zeile 149 | Zeile 156 |
---|
$this->host = @ini_get('SMTP'); } else
|
$this->host = @ini_get('SMTP'); } else
|
{
| {
|
$this->host = $mybb->settings['smtp_host']; }
| $this->host = $mybb->settings['smtp_host']; }
|
Zeile 160 | Zeile 167 |
---|
if(empty($mybb->settings['smtp_port']) && !empty($protocol) && !@ini_get('smtp_port')) { $this->port = $this->secure_port;
|
if(empty($mybb->settings['smtp_port']) && !empty($protocol) && !@ini_get('smtp_port')) { $this->port = $this->secure_port;
|
}
| }
|
else if(empty($mybb->settings['smtp_port']) && @ini_get('smtp_port')) { $this->port = @ini_get('smtp_port');
| else if(empty($mybb->settings['smtp_port']) && @ini_get('smtp_port')) { $this->port = @ini_get('smtp_port');
|
Zeile 192 | Zeile 199 |
---|
{ if(!$this->send_data('MAIL FROM:<'.$this->from.'>', '250')) {
|
{ if(!$this->send_data('MAIL FROM:<'.$this->from.'>', '250')) {
|
$this->fatal_error("The mail server does not understand the MAIL FROM command");
| $this->fatal_error("The mail server does not understand the MAIL FROM command. Reason: ".$this->get_error());
|
return false; }
| return false; }
|
Zeile 202 | Zeile 209 |
---|
{ $to = trim($to); if(!$this->send_data('RCPT TO:<'.$to.'>', '250'))
|
{ $to = trim($to); if(!$this->send_data('RCPT TO:<'.$to.'>', '250'))
|
{ $this->fatal_error("The mail server does not understand the RCPT TO command"); return false; } }
| { $this->fatal_error("The mail server does not understand the RCPT TO command. Reason: ".$this->get_error()); return false; } }
|
if($this->send_data('DATA', '354')) { $this->send_data('Date: ' . gmdate('r')); $this->send_data('To: ' . $this->to);
|
if($this->send_data('DATA', '354')) { $this->send_data('Date: ' . gmdate('r')); $this->send_data('To: ' . $this->to);
|
|
|
$this->send_data('Subject: ' . $this->subject);
// Only send additional headers if we've got any
| $this->send_data('Subject: ' . $this->subject);
// Only send additional headers if we've got any
|
Zeile 228 | Zeile 235 |
---|
$this->send_data($this->message); } else
|
$this->send_data($this->message); } 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;
|
}
$this->send_data('.', '250');
| }
$this->send_data('.', '250');
|
if(!$this->keep_alive) {
| if(!$this->keep_alive) {
|
Zeile 249 | Zeile 256 |
---|
/** * Connect to the SMTP server.
|
/** * Connect to the SMTP server.
|
*
| *
|
* @return boolean True if connection was successful */ function connect()
| * @return boolean True if connection was successful */ function connect()
|
Zeile 332 | Zeile 339 |
---|
if(!$this->send_data(base64_encode($this->username), '334')) {
|
if(!$this->send_data(base64_encode($this->username), '334')) {
|
$this->fatal_error("The SMTP server rejected the supplied SMTP username");
| $this->fatal_error("The SMTP server rejected the supplied SMTP username. Reason: ".$this->get_error());
|
return false; } if(!$this->send_data(base64_encode($this->password), '235'))
|
return false; } if(!$this->send_data(base64_encode($this->password), '235'))
|
{ $this->fatal_error("The SMTP server rejected the supplied SMTP password"); return false;
| { $this->fatal_error("The SMTP server rejected the supplied SMTP password. Reason: ".$this->get_error()); return false;
|
} } else if(in_array("PLAIN", $auth_methods)) { if(!$this->send_data("AUTH PLAIN", '334'))
|
} } else if(in_array("PLAIN", $auth_methods)) { if(!$this->send_data("AUTH PLAIN", '334'))
|
{
| {
|
if($this->code == 503) { return true;
| if($this->code == 503) { return true;
|
Zeile 356 | Zeile 363 |
---|
$auth = base64_encode(chr(0).$this->username.chr(0).$this->password); if(!$this->send_data($auth, 235)) {
|
$auth = base64_encode(chr(0).$this->username.chr(0).$this->password); if(!$this->send_data($auth, 235)) {
|
$this->fatal_error("The SMTP server rejected the supplied login username and password");
| $this->fatal_error("The SMTP server rejected the supplied login username and password. Reason: ".$this->get_error());
|
return false; } }
| return false; } }
|
Zeile 383 | Zeile 390 |
---|
{ $string .= $line; if(substr($line, 3, 1) == ' ')
|
{ $string .= $line; if(substr($line, 3, 1) == ' ')
|
{
| {
|
break; } }
| break; } }
|
Zeile 428 | Zeile 435 |
---|
} else {
|
} else {
|
| $this->set_error($rec);
|
return false; } }
| return false; } }
|
Zeile 471 | Zeile 479 |
---|
fclose($this->connection); $this->status = 0; }
|
fclose($this->connection); $this->status = 0; }
|
| } /** * Get the last error message response from the SMTP server * * @return string The error message response from the SMTP server */ function get_error() { if(!$this->last_error) { $this->last_error = "N/A"; } return $this->last_error; } /** * Set the last error message response from the SMTP server * * @param string The error message response */ function set_error($error) { $this->last_error = $error;
|
} } ?>
| } } ?>
|