note 47327 deleted from function.base64-encode by betz
| From: | betz@php.net | Date: | Thu, 09 Feb 2006 16:50:16 +0000 |
| Subject: | note 47327 deleted from function.base64-encode by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-103379@lists.php.net to get a copy of this message | ||
Note Submitter: David Monroe diexmax at rediffmail dot com
----
Use this code to send attachments in email body.
Ps. Jackie, I love you, did you love me too
Start here:
$arquivo = "spider.jpg";
$tipo = "image/jpg";
//$arquivo is file and $tipo is type
$abreArquivo = fopen ($arquivo, "r");
//$abreArquivo is openFile
$dados = fread ($abreArquivo, filesize($arquivo));
fclose ($abreArquivo);
$encode_anexo = chunk_split (base64_encode($dados));
$cabeca = "--Message-Boundary\n";
$cabeca .= "Content-type: text/plain; charset=US-ASCII\n";
$cabeca .= "Content-transfer-encoding: 7BIT\n";
$cabeca .= "Content-description: Mail message body\n\n";
$corpo = $cabeca . $corpo;
//$corpo is BODY
$corpo .= "Your text here HERE\n";
$corpo .= "\n\n--Message-Boundary\n";
$corpo .= "Content-type: $attach_type; name=\"$arquivo\"\n";
$corpo .= "Content-Transfer-Encoding: BASE64\n";
$corpo .= "Content-disposition: attachment; filename=\"$arquivo\"\n\n";
$corpo .= "$encode_anexo\n";
$corpo .= "--Message-Boundary--\n";
mail("diexmax@rediffmail.com< please remove my e-mail it´s only one
example>", "Your subject", $corpo, $headers);
the end
very easy
To Brazilians friends begin here
Usem o codigo acima para enviarem anexos no corpo do e-mail.