note 21882 added to ref.mail
| From: | lucifer at vengeance dot et dot tudelft dot nl | Date: | Thu, 30 May 2002 13:02:00 +0000 |
| Subject: | note 21882 added to ref.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31198@lists.php.net to get a copy of this message | ||
This is some quick code to get attachments working (for not only Outlook, like many other examples i
found on the web). You have to put in code to make proper boundaries and read files etc, but I
presume that if you're searching for this piece of code, you already know how to do that.
<?php
$enter = "\r\n";
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-Type: multipart/mixed;";
$headers[] = " boundary=\"blabla\"";
$headers[] = "This is a multi-part message in MIME format.";
$headers[] = "--blabla";
$headers[] = "Content-Type: multipart/text;";
$headers[] = "";
$headers[] = "contents of the text part!";
$headers[] = "--blabla";
$headers[] = "Content-Type: application/octet-stream;";
$headers[] = " name=\"file description\"";
$headers[] = "Content-Transfer-Encoding: base64";
$headers[] = "Content-Disposition: attachment;";
$headers[] = " filename=\"file name\"";
$headers[] = "";
$headers[] = chunk_split(base64_encode("contents of file"));
$headers[] = "";
$headers[] = "--blabla--";
mail( 'foo@bar.nl', 'test', '', join($enter,$headers) );
?>
Jan David Mol,
The Netherlands
--
http://www.php.net/manual/en/ref.mail.php
http://master.php.net/manage/user-notes.php?action=edit+21882
http://master.php.net/manage/user-notes.php?action=delete+21882
http://master.php.net/manage/user-notes.php?action=reject+21882