I'm trying to send email with embedded image in text through boundary .
In Gmail everything is beautiful, as always, but in Outlook the text does not arrive in HTML and the image arrives as an attachment.
<?
@date_default_timezone_set('America/Bahia');
$imagem_nome="imagens/logomarca.png";
$arquivo=fopen($imagem_nome,'r');
$contents = fread($arquivo, filesize($imagem_nome));
$encoded_attach = chunk_split(base64_encode($contents));
fclose($arquivo);
$limitador = "_=======". date('YmdHms'). time() . "=======_";
$limitador2 = "_=======". date('sYmdHms'). time() . "=======_";
$mailheaders = "From: [email protected]\r\n";
$mailheaders .= "MIME-version: 1.0\r\n";
$mailheaders .= "Content-type: multipart/related; boundary=\"$limitador\"\r\n";
$cid = date('YmdHms').'.'.time();
$texto="
<html>
<body>
<img src=\"cid:$cid\">
<font size=6><br />blablabla </font>
</body>
</html>
";
$msg_body = "--$limitador\r\n";
$msg_body .= "Content-Type: multipart/alternative; boundary=\"$limitador2\"\r\n";
$msg_body .= "--$limitador2\r\n";
$msg_body .= "Content-type: text/html; charset=iso-8859-1\r\n";
$msg_body .= "Content-Transfer-Encoding: quoted-printable\r\n";
$msg_body .= "$texto";
$msg_body .= "--$limitador2--\r\n";
$msg_body .= "--$limitador\r\n";
$msg_body .= "Content-type: image/png; name=\"$imagem_nome\"\r\n";
$msg_body .= "Content-Transfer-Encoding: base64\r\n";
$msg_body .= "Content-Disposition: inline; filaname=\"$imagem_nome\"\r\n";
$msg_body .= "Content-ID: <$cid>\r\n";
$msg_body .= "\n$encoded_attach\r\n";
$msg_body .= "--$limitador--\r\n";
if(mail("[email protected]","TEste",$msg_body, $mailheaders)){
echo"Mensagem enviada";
}
?>
What can I do to solve the problem?