/**
* @brief Set the message
* @param string $_message
*/
public function setMessage($_message)
{
// check for straight text
$html = !strpos($_message,"<br") ? nl2br($_message) : $_message;
$text = str_replace('<p>', "\n\r", $_message);
$text = str_replace('</p>', "\n\r", $text);
$text = str_replace('<h1>', "\n\r", $text);
$text = str_replace('</h1>', "\n\r", $text);blog
$text = str_replace('<h2>', "\n\r", $text);
$text = str_replace('</h2>', "\n\r", $text);
// text email
$this->textHeader .= '--' . $this->textBoundary. "\r\n";
$this->textHeader .= 'Content-Type: text/plain; charset=utf-8' . "\r\n";
$this->textHeader .= 'Content-Transfer-Encoding: quoted-printable' . "\r\n";
$this->textHeader .= 'Content-Disposition: inline' . "\r\n" . "\r\n";
$this->textHeader .= $text. "\r\n" . "\r\n";
// html email
$this->textHeader .= '--'.$this->textBoundary . "\r\n";
$this->textHeader .= 'Content-Type: text/html; charset=utf-8' . "\r\n";
$this->textHeader .= 'Content-Transfer-Encoding: quoted-printable' . "\r\n";
$this->textHeader .= 'Content-Disposition: inline' . "\r\n" . "\r\n";
$this->textHeader .= '<!DOCTYPE html>' . "\r\n";
$this->textHeader .= '<html lang="en">' . "\r\n";
$this->textHeader .= '<head>' . "\r\n";
$this->textHeader .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . "\r\n";
$this->textHeader .= '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\r\n";
$this->textHeader .= '<style></style>' . "\r\n";
$this->textHeader .= '</head>' . "\r\n";
$this->textHeader .= '<body>' . "\r\n";
$this->textHeader .= $html . "\r\n" . "\r\n";
$this->textHeader .= '</body>' . "\r\n";
$this->textHeader .= '</html>' . "\r\n";
//$this->textHeader .= "--".$this->textBoundary. "\r\n";
}
The extra message boundary was ignored by every tested email and client except gmail web.
The webclient chose to display the 'empty' section.
No comments:
Post a Comment