Preciso de um formmail que tenha a opção de enviar um e-mail com um arquivo anexo, tipo essa screenshot anexa que eu vi na net.
Se alguém souber, me avisa!!!
Obs.: não quero fazer upload do arquivo pro servidor. O arquivo tem que ir anexo no e-mail.
Posted 13/02/2004, 01:31
Posted 13/02/2004, 11:48
Posted 17/02/2004, 09:26
Posted 19/03/2004, 01:47
Posted 19/03/2004, 05:54
<?php
$boundary = strtotime('NOW');
$headers = "From: Eu <meu@email.com.br>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"" . $boundary . "\"\n";
$msg = "--" . $boundary . "\n";
$msg .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$msg .= "Content-Transfer-Encoding: quoted-printable\n\n";
$msg .= "Aqui eu escrevo o texto do email\n";
$msg .= "--" . $boundary . "\n";
$msg .= "Content-Transfer-Encoding: base64\n";
$msg .= "Content-Disposition: attachment; filename=\"imagem.gif\"\n\n";
ob_start();
readfile("imagem.gif");
$enc = ob_get_contents();
ob_end_clean();
$msg_temp = base64_encode($enc). "\n";
$tmp[1] = strlen($msg_temp);
$tmp[2] = ceil($tmp[1]/76);
for ($b = 0; $b <= $tmp[2]; $b++) {
$tmp[3] = $b * 76;
$msg .= substr($msg_temp, $tmp[3], 76) . "\n";
}
unset($msg_temp, $tmp, $enc);
mail("para@email.com.br", "Assunto", $msg, $headers);
?>
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)