Hi,
Previously, I had some code to send an email without attachments, just text with html enabled so I had custom fonts, background colours etc. Now I've added attachment support to my code, but something is causing the font-family attributes to be ignored.
Current code:
<pre>$uid = md5(uniqid(time()));
$filename = 'invoice.html';
$file_size = filesize($filepath);
$content = chunk_split(base64_encode(file_get_contents($filepath)));
$headers = "From: Me <myemail.co.uk>\r\n";
$headers .= "Reply-To: myemail.co.uk\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n\r\n";
$headers .= "This is a multi-part message in MIME format.\r\n";
$headers .= "--" . $uid . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// html is now enabled
$headers .= $message . "\r\n\r\n";
$headers .= "--" . $uid . "\r\n";
$headers .= "Content-Type: application/octet-stream; name=\"" . $filename . "\"\r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n";
$headers .= "Content-Disposition: attachment; filename=\"" . $filename . "\"\r\n\r\n";
$headers .= $content . "\r\n\r\n";
$headers .= "--" . $uid . "--";
This is now called using:
mail('email@whatever', 'subject', '', $headers);
But the previous version, where fonts worked, was
mail('email@whatever', 'subject', 'body', $headers);
Any help to identify the issue would be appreciated c:
What I have tried:
----------------------------------------------------------------------------------------------------