I have this function, which sends an email to the user and confirms an order.
I cant figure out why I cant get to display the image IN the email, at the very top.
I have tried with:
"Content-Disposition: attachment; filename=\"mail-top-img.gif\""
And
"Content-Disposition: inline; filename=\"mail-top-img.gif\""
Both sends the mail as an attachment to the message.
This is the function where something needs to be changed for the image to appear in the message body:
<?php
function mail_img_kvittering($to, $from, $subject, $body)
{
$boundary = md5(rand());
$headers = array(
"MIME-Version: 1.0",
"Content-Type: multipart/mixed; boundary=\"{$boundary}\"",
"From: {$from}"
);
$message = array(
"--{$boundary}",
"Content-Type: image/gif; name=\"mail-top-img.gif\"",
"Content-Transfer-Encoding: base64",
"Content-Disposition: attachment; filename=\"mail-top-img.gif\"",
"",
chunk_split(base64_encode(file_get_contents("css/mail-top-img.gif"))),
"--{$boundary}",
"Content-Type: text/html; charset=utf-8",
"Content-Transfer-Encoding: 7bit",
"",
$body,
"--{$boundary}--"
);
mail($to, $subject, implode("\r\n", $message), implode("\r\n", $headers));
}
?>
`