#146 All emails will now be sent as multipart/alternative
Shouldn't cause issues w/plaintext emails, and it'll make it easier to add attachments.
This commit is contained in:
parent
42f67322c5
commit
ab7f4e1cc1
@ -411,13 +411,13 @@ function hesk_mail($to,$subject,$message,$htmlMessage,$cc=array(),$bcc=array())
|
|||||||
}
|
}
|
||||||
|
|
||||||
$boundary = sha1(uniqid());
|
$boundary = sha1(uniqid());
|
||||||
|
$plaintextMessage = $message;
|
||||||
|
$message = "--".$boundary."\n";
|
||||||
|
$message .= "Content-Type: text/plain; charset=".$hesklang['ENCODING']."\n\n";
|
||||||
|
$message .= $plaintextMessage."\n\n";
|
||||||
//Prepare the message for HTML or non-html
|
//Prepare the message for HTML or non-html
|
||||||
if ($modsForHesk_settings['html_emails'])
|
if ($modsForHesk_settings['html_emails'])
|
||||||
{
|
{
|
||||||
$plaintextMessage = $message;
|
|
||||||
$message = "--".$boundary."\n";
|
|
||||||
$message .= "Content-Type: text/plain; charset=".$hesklang['ENCODING']."\n\n";
|
|
||||||
$message .= $plaintextMessage."\n\n";
|
|
||||||
$message .= "--".$boundary."\n";
|
$message .= "--".$boundary."\n";
|
||||||
$message .= "Content-Type: text/html; charset=".$hesklang['ENCODING']."\n\n";
|
$message .= "Content-Type: text/html; charset=".$hesklang['ENCODING']."\n\n";
|
||||||
$message .= $htmlMessage."\n\n";
|
$message .= $htmlMessage."\n\n";
|
||||||
@ -429,10 +429,7 @@ function hesk_mail($to,$subject,$message,$htmlMessage,$cc=array(),$bcc=array())
|
|||||||
{
|
{
|
||||||
// Set additional headers
|
// Set additional headers
|
||||||
$headers = '';
|
$headers = '';
|
||||||
if ($modsForHesk_settings['html_emails'])
|
$headers .= "MIME-Version: 1.0\n";
|
||||||
{
|
|
||||||
$headers .= "MIME-Version: 1.0\n";
|
|
||||||
}
|
|
||||||
$headers .= "From: $hesk_settings[from_header]\n";
|
$headers .= "From: $hesk_settings[from_header]\n";
|
||||||
if (count($cc) > 0)
|
if (count($cc) > 0)
|
||||||
{
|
{
|
||||||
@ -445,10 +442,7 @@ function hesk_mail($to,$subject,$message,$htmlMessage,$cc=array(),$bcc=array())
|
|||||||
$headers.= "Reply-To: $hesk_settings[from_header]\n";
|
$headers.= "Reply-To: $hesk_settings[from_header]\n";
|
||||||
$headers.= "Return-Path: $hesk_settings[webmaster_mail]\n";
|
$headers.= "Return-Path: $hesk_settings[webmaster_mail]\n";
|
||||||
$headers.= "Date: " . date(DATE_RFC2822) . "\n";
|
$headers.= "Date: " . date(DATE_RFC2822) . "\n";
|
||||||
if ($modsForHesk_settings['html_emails'])
|
$headers.= "Content-Type: multipart/alternative;boundary=".$boundary;
|
||||||
{
|
|
||||||
$headers.= "Content-Type: multipart/alternative;boundary=".$boundary;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send using PHP mail() function
|
// Send using PHP mail() function
|
||||||
ob_start();
|
ob_start();
|
||||||
@ -484,14 +478,9 @@ function hesk_mail($to,$subject,$message,$htmlMessage,$cc=array(),$bcc=array())
|
|||||||
"Subject: " . $subject,
|
"Subject: " . $subject,
|
||||||
"Date: " . date(DATE_RFC2822)
|
"Date: " . date(DATE_RFC2822)
|
||||||
);
|
);
|
||||||
if ($modsForHesk_settings['html_emails'])
|
array_push($headersArray,"MIME-Version: 1.0");
|
||||||
{
|
array_push($headersArray,"Content-Type: multipart/alternative;boundary=".$boundary);
|
||||||
array_push($headersArray,"MIME-Version: 1.0");
|
|
||||||
array_push($headersArray,"Content-Type: multipart/alternative;boundary=".$boundary);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
array_push($headersArray,"Content-Type: text/plain; charset=" . $hesklang['ENCODING']);
|
|
||||||
}
|
|
||||||
if (count($cc) > 0)
|
if (count($cc) > 0)
|
||||||
{
|
{
|
||||||
array_push($headersArray,"Cc: ".implode(',',$cc));
|
array_push($headersArray,"Cc: ".implode(',',$cc));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user