note 57354 deleted from function.base64-encode by mazzanet
| From: | mazzanet@php.net | Date: | Sat, 01 Oct 2005 10:29:42 +0000 |
| Subject: | note 57354 deleted from function.base64-encode by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96128@lists.php.net to get a copy of this message | ||
Note Submitter: ds_available at yahoo dot com
----
to send multiple attatchments in your html mail
try this code
Dinesh Sharma
<?
$message = '
This is a multi-part message in MIME format.
------=_NextPart_001_0011_1234ABCD.4321FDAC
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hello
We have attached for you the file you requested
<html><body><font color=red>hi
dinesh<br></font></body></html>
Regards
Dinesh
' ;
foreach($_FILES['attachment']['error'] as $key => $error) {
if($error == UPLOAD_ERR_OK) {
$filename = $_FILES['attachment']['name'][$key];
$thisfile=$filename;
$filetype = $_FILES['attachment']['type'][$key];
// Encode the file ready to send it off
$handle = fopen($_FILES['attachment']['tmp_name'][$key],'rb');
$file_content =
fread($handle,filesize($_FILES['attachment']['tmp_name'][$key]));
fclose($handle);
$encoded = chunk_split(base64_encode($file_content));
// create the email and send it off
$message .= '------=_NextPart_001_0011_1234ABCD.4321FDAC
Content-Type: application/octet-stream;name="';
$message .= "$thisfile";
$message .= '"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="';
$message .= "$thisfile";
$message .= '"
';
$message .= $sep." $encoded".$sep;
}
}
$message .= '
------=_NextPart_001_0011_1234ABCD.4321FDAC--
';
echo $message."<br><br>";
?>