Zeile 33 | Zeile 33 |
---|
* @var string */ public $from;
|
* @var string */ public $from;
|
| /** * Full from string including name in format "name" <email> * * @var string */ public $from_named;
|
/** * Who the email should return to.
| /** * Who the email should return to.
|
Zeile 43 | Zeile 50 |
---|
/** * The subject of mail.
|
/** * The subject of mail.
|
* * @var string */
| * * @var string */
|
public $subject;
/**
| public $subject;
/**
|
Zeile 64 | Zeile 71 |
---|
/** * The headers of the mail.
|
/** * The headers of the mail.
|
* * @var string */
| * * @var string */
|
public $headers;
/**
| public $headers;
/**
|
Zeile 76 | Zeile 83 |
---|
* @default utf-8 */ public $charset = "utf-8";
|
* @default utf-8 */ public $charset = "utf-8";
|
/**
| /**
|
* The currently used delimiter new lines.
|
* The currently used delimiter new lines.
|
* * @var string. */
| * * @var string */
|
public $delimiter = "\r\n";
/** * How it should parse the email (HTML or plain text?) *
|
public $delimiter = "\r\n";
/** * How it should parse the email (HTML or plain text?) *
|
* @var array
| * @var string
|
*/ public $parse_format = 'text';
|
*/ public $parse_format = 'text';
|
| /** * The last received response from the SMTP server. * * @var string */ public $data = '';
/** * The last received response code from the SMTP server. * * @var string */ public $code = 0;
/** * Selects between AdminEmail and ReturnEmail, dependant on if ReturnEmail is filled. * * @return string */ function get_from_email() { global $mybb; if(trim($mybb->settings['returnemail'])) { $email = $mybb->settings['returnemail']; } else { $email = $mybb->settings['adminemail']; } return $email; }
|
/** * Builds the whole mail. * To be used by the different email classes later. *
|
/** * Builds the whole mail. * To be used by the different email classes later. *
|
* @param string to email. * @param string subject of email. * @param string message of email. * @param string from email. * @param string charset of email. * @param string headers of email. * @param string format of the email (HTML, plain text, or both?). * @param string plain text version of the email. * @param string the return email address.
| * @param string $to to email. * @param string $subject subject of email. * @param string $message message of email. * @param string $from from email. * @param string $charset charset of email. * @param string $headers headers of email. * @param string $format format of the email (HTML, plain text, or both?). * @param string $message_text plain text version of the email. * @param string $return_email the return email address.
|
*/ function build_message($to, $subject, $message, $from="", $charset="", $headers="", $format="text", $message_text="", $return_email="") {
| */ function build_message($to, $subject, $message, $from="", $charset="", $headers="", $format="text", $message_text="", $return_email="") {
|
Zeile 111 | Zeile 153 |
---|
$this->message = ''; $this->headers = $headers;
|
$this->message = ''; $this->headers = $headers;
|
|
|
if($from)
|
if($from)
|
{
| {
|
$this->from = $from;
|
$this->from = $from;
|
| $this->from_named = $this->from;
|
} else {
|
} 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']}>"; } }
| $this->from = $this->get_from_email(); $this->from_named = '"'.$this->utf8_encode($mybb->settings['bbname']).'"'; $this->from_named .= " <".$this->from.">"; }
|
if($return_email)
|
if($return_email)
|
{
| {
|
$this->return_email = $return_email; } else {
|
$this->return_email = $return_email; } else {
|
$this->return_email = ""; if($mybb->settings['returnemail']) { $this->return_email = $mybb->settings['returnemail']; } else { $this->return_email = $mybb->settings['adminemail']; }
| $this->return_email = $this->get_from_email();
|
}
$this->set_to($to);
| }
$this->set_to($to);
|
Zeile 164 | Zeile 191 |
---|
/** * Sets the charset. *
|
/** * Sets the charset. *
|
* @param string charset
| * @param string $charset charset
|
*/ function set_charset($charset) {
| */ function set_charset($charset) {
|
Zeile 183 | Zeile 210 |
---|
/** * Sets and formats the email message. *
|
/** * Sets and formats the email message. *
|
* @param string message
| * @param string $message message * @param string $message_text
|
*/ function set_message($message, $message_text="") {
| */ function set_message($message, $message_text="") {
|
Zeile 208 | Zeile 236 |
---|
/** * Sets and formats the email subject. *
|
/** * Sets and formats the email subject. *
|
* @param string subject
| * @param string $subject
|
*/ function set_subject($subject) {
| */ function set_subject($subject) {
|
Zeile 219 | Zeile 247 |
---|
/** * Sets and formats the recipient address. *
|
/** * Sets and formats the recipient address. *
|
* @param string to
| * @param string $to
|
*/ function set_to($to) {
| */ function set_to($to) {
|
Zeile 239 | Zeile 267 |
---|
/** * Sets the alternative headers, text/html and text/plain. *
|
/** * Sets the alternative headers, text/html and text/plain. *
|
* @param string message
| * @param string $message * @param string $message_text
|
*/ function set_html_headers($message, $message_text="") {
| */ function set_html_headers($message, $message_text="") {
|
Zeile 284 | Zeile 313 |
---|
global $mybb;
// Build mail headers
|
global $mybb;
// Build mail headers
|
$this->headers .= "From: {$this->from}{$this->delimiter}";
| $this->headers .= "From: {$this->from_named}{$this->delimiter}";
|
if($this->return_email) {
| if($this->return_email) {
|
Zeile 320 | Zeile 349 |
---|
/** * Log a fatal error message to the database. *
|
/** * Log a fatal error message to the database. *
|
* @param string The error message * @param string Any additional information
| * @param string $error The error message
|
*/ function fatal_error($error) {
| */ function fatal_error($error) {
|
Zeile 345 | Zeile 373 |
---|
/** * 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
| * @param string $string The string being checked
|
* @return string The cleaned string */ function cleanup($string)
| * @return string The cleaned string */ function cleanup($string)
|
Zeile 359 | Zeile 387 |
---|
* Converts message text to suit the correct delimiter * See dev.mybb.com/issues/1735 (Jorge Oliveira) *
|
* Converts message text to suit the correct delimiter * See dev.mybb.com/issues/1735 (Jorge Oliveira) *
|
* @param string The text being converted
| * @param string $text The text being converted
|
* @return string The converted string */ function cleanup_crlf($text)
| * @return string The converted string */ function cleanup_crlf($text)
|
Zeile 376 | Zeile 404 |
---|
* and recipients in email messages going out so that they show up correctly * in email clients. *
|
* and recipients in email messages going out so that they show up correctly * in email clients. *
|
* @param string The string to be encoded.
| * @param string $string The string to be encoded.
|
* @return string The encoded string. */ function utf8_encode($string)
| * @return string The encoded string. */ function utf8_encode($string)
|
Zeile 392 | Zeile 420 |
---|
{ $newpos = min($pos + $chunk_size, $len);
|
{ $newpos = min($pos + $chunk_size, $len);
|
while(ord($string[$newpos]) >= 0x80 && ord($string[$newpos]) < 0xC0)
| if($newpos != $len)
|
{
|
{
|
// Reduce len until it's safe to split UTF-8. $newpos--;
| while(ord($string[$newpos]) >= 0x80 && ord($string[$newpos]) < 0xC0) { // Reduce len until it's safe to split UTF-8. $newpos--; }
|
}
$chunk = substr($string, $pos, $newpos - $pos);
| }
$chunk = substr($string, $pos, $newpos - $pos);
|