Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: class_mailhandler.php 5016 2010-06-12 00:24:02Z RyanGordon $
| * $Id$
|
*/
/**
| */
/**
|
Zeile 120 | Zeile 120 |
---|
else { $this->from = "";
|
else { $this->from = "";
|
| if($mybb->settings['mail_handler'] == 'smtp') { $this->from = $mybb->settings['adminemail']; } else { $this->from = '"'.$this->utf8_encode($mybb->settings['bbname']).'"'; $this->from .= " <{$mybb->settings['adminemail']}>"; }
|
}
|
}
|
|
|
if($return_email) { $this->return_email = $return_email;
|
if($return_email) { $this->return_email = $return_email;
|
}
| }
|
else
|
else
|
{
| {
|
$this->return_email = "";
|
$this->return_email = "";
|
}
| if($mybb->settings['returnemail']) { $this->return_email = $mybb->settings['returnemail']; } else { $this->return_email = $mybb->settings['adminemail']; } }
|
$this->set_to($to); $this->set_subject($subject);
|
$this->set_to($to); $this->set_subject($subject);
|
|
|
if($charset) { $this->set_charset($charset); }
|
if($charset) { $this->set_charset($charset); }
|
|
|
$this->parse_format = $format; $this->set_common_headers(); $this->set_message($message, $message_text);
|
$this->parse_format = $format; $this->set_common_headers(); $this->set_message($message, $message_text);
|
| |
}
/**
| }
/**
|
Zeile 168 | Zeile 187 |
---|
* @param string message */ function set_message($message, $message_text="")
|
* @param string message */ function set_message($message, $message_text="")
|
{ if($this->parse_format == "html" || $this->parse_format == "both")
| { $message = $this->cleanup_crlf($message);
if($message_text) { $message_text = $this->cleanup_crlf($message_text); }
if($this->parse_format == "html" || $this->parse_format == "both")
|
{ $this->set_html_headers($message, $message_text); }
| { $this->set_html_headers($message, $message_text); }
|
Zeile 177 | Zeile 203 |
---|
{ $this->message = $message; $this->set_plain_headers();
|
{ $this->message = $message; $this->set_plain_headers();
|
}
| }
|
}
/** * Sets and formats the email subject. * * @param string subject
|
}
/** * Sets and formats the email subject. * * @param string subject
|
*/
| */
|
function set_subject($subject) { $this->orig_subject = $this->cleanup($subject); $this->subject = $this->utf8_encode($this->orig_subject);
|
function set_subject($subject) { $this->orig_subject = $this->cleanup($subject); $this->subject = $this->utf8_encode($this->orig_subject);
|
}
/**
| }
/**
|
* Sets and formats the recipient address. * * @param string to
| * Sets and formats the recipient address. * * @param string to
|
Zeile 205 | Zeile 231 |
---|
/** * Sets the plain headers, text/plain
|
/** * Sets the plain headers, text/plain
|
*/
| */
|
function set_plain_headers() { $this->headers .= "Content-Type: text/plain; charset={$this->charset}{$this->delimiter}";
| function set_plain_headers() { $this->headers .= "Content-Type: text/plain; charset={$this->charset}{$this->delimiter}";
|
Zeile 259 | Zeile 285 |
---|
global $mybb;
// Build mail headers
|
global $mybb;
// Build mail headers
|
if(!trim($this->from)) { if($mybb->settings['mail_handler'] == 'smtp') { $this->from = $mybb->settings['adminemail']; } else { $this->from = '"'.$this->utf8_encode($mybb->settings['bbname']).'"'; $this->from .= " <{$mybb->settings['adminemail']}>"; } }
| |
$this->headers .= "From: {$this->from}{$this->delimiter}"; if($this->return_email)
|
$this->headers .= "From: {$this->from}{$this->delimiter}"; if($this->return_email)
|
{
| {
|
$this->headers .= "Return-Path: {$this->return_email}{$this->delimiter}"; $this->headers .= "Reply-To: {$this->return_email}{$this->delimiter}";
|
$this->headers .= "Return-Path: {$this->return_email}{$this->delimiter}"; $this->headers .= "Reply-To: {$this->return_email}{$this->delimiter}";
|
} elseif($mybb->settings['returnemail']) { $this->headers .= "Return-Path: {$mybb->settings['returnemail']}{$this->delimiter}"; $this->headers .= "Reply-To: {$mybb->settings['adminemail']}{$this->delimiter}"; } else { $this->headers .= "Return-Path: {$mybb->settings['adminemail']}{$this->delimiter}"; $this->headers .= "Reply-To: {$mybb->settings['adminemail']}{$this->delimiter}";
| |
}
if(isset($_SERVER['SERVER_NAME']))
| }
if(isset($_SERVER['SERVER_NAME']))
|
Zeile 311 | Zeile 314 |
---|
} $this->headers .= "Content-Transfer-Encoding: 8bit{$this->delimiter}"; $this->headers .= "X-Priority: 3{$this->delimiter}";
|
} $this->headers .= "Content-Transfer-Encoding: 8bit{$this->delimiter}"; $this->headers .= "X-Priority: 3{$this->delimiter}";
|
$this->headers .= "X-MSMail-Priority: Normal{$this->delimiter}";
| |
$this->headers .= "X-Mailer: MyBB{$this->delimiter}"; $this->headers .= "MIME-Version: 1.0{$this->delimiter}"; }
| $this->headers .= "X-Mailer: MyBB{$this->delimiter}"; $this->headers .= "MIME-Version: 1.0{$this->delimiter}"; }
|
Zeile 325 | Zeile 327 |
---|
function fatal_error($error) { global $db;
|
function fatal_error($error) { global $db;
|
|
|
$mail_error = array( "subject" => $db->escape_string($this->orig_subject), "message" => $db->escape_string($this->message),
| $mail_error = array( "subject" => $db->escape_string($this->orig_subject), "message" => $db->escape_string($this->message),
|
Zeile 339 | Zeile 341 |
---|
$db->insert_query("mailerrors", $mail_error); // Another neat feature would be the ability to notify the site administrator via email - but wait, with email down, how do we do that? How about private message and hope the admin checks their PMs?
|
$db->insert_query("mailerrors", $mail_error); // Another neat feature would be the ability to notify the site administrator via email - but wait, with email down, how do we do that? How about private message and hope the admin checks their PMs?
|
}
| }
|
/** * Rids pesky characters from subjects, recipients, from addresses etc (prevents mail injection too)
|
/** * Rids pesky characters from subjects, recipients, from addresses etc (prevents mail injection too)
|
*
| *
|
* @param string The string being checked * @return string The cleaned string
|
* @param string The string being checked * @return string The cleaned string
|
*/
| */
|
function cleanup($string) { $string = str_replace(array("\r", "\n", "\r\n"), "", $string); $string = trim($string); return $string; }
|
function cleanup($string) { $string = str_replace(array("\r", "\n", "\r\n"), "", $string); $string = trim($string); return $string; }
|
| /** * Converts message text to suit the correct delimiter * See dev.mybb.com/issues/1735 (Jorge Oliveira) * * @param string The text being converted * @return string The converted string */ function cleanup_crlf($text) { $text = str_replace("\r\n", "\n", $text); $text = str_replace("\r", "\n", $text); $text = str_replace("\n", "\r\n", $text);
return $text; }
|
/** * Encode a string based on the character set enabled. Used to encode subjects * and recipients in email messages going out so that they show up correctly
| /** * Encode a string based on the character set enabled. Used to encode subjects * and recipients in email messages going out so that they show up correctly
|