Email com imagem
Ola pessoal, estava busncando por formas de enviar e-mail com img e acabei encontrando o codigo q segue abaixo, porem não entendi mto bem como funcionam algumas coisas, como esse cid, limite, caso eu kisesse manda mais de uma img como poderia fazer??
CODE
<?
$imagem_nome="img.jpg";
$arquivo=fopen($imagem_nome,'r');
$contents = fread($arquivo, filesize($imagem_nome));
$encoded_attach = chunk_split(base64_encode($contents));
fclose($arquivo);
$limitador = "_=======". date('YmdHms'). time() . "=======_";
$mailheaders = "From: remetente@host.com\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: text/html; charset=iso-8859-1\r\n";
$msg_body .= "$texto";
$msg_body .= "--$limitador\r\n";
$msg_body .= "Content-type: image/jpeg; name=\"$imagem_nome\"\r\n";
$msg_body .= "Content-Transfer-Encoding: base64\r\n";
$msg_body .= "Content-ID: <$cid>\r\n";
$msg_body .= "\n$encoded_attach\r\n";
$msg_body .= "--$limitador--\r\n";
mail("destino@host.com","Assunto",$msg_body, $mailheaders);
?>Discussão (1)
Carregando comentários...