email attach and contain message together
| From: | agung at prematours dot com | Date: | Fri, 04 Mar 2005 20:37:12 +0000 |
| Subject: | email attach and contain message together | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-209960@lists.php.net to get a copy of this message | ||
Hi all
I have the problem which I would like to send email with contain and
attachment ( excel file) together not just a part.
What should I do with the term please help
here the part of the code I use :
<?php
$boundary = '-----=' . md5( uniqid ( rand() ) );
$to = $HTTP_POST_VARS['email']. ', ';
$to .= $HTTP_POST_VARS['email2']. ', ';
$to .= $HTTP_POST_VARS['email3']. ', ';
$to .= $HTTP_POST_VARS['email4']. ', ';
$to .= $HTTP_POST_VARS['email5'];
$subject = $HTTP_POST_VARS['subject'];
$message = $HTTP_POST_VARS['message'];
$headers = "MIME-Version: 1.0\r \n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r \n";
$headers .= "X-Priority: 3\r \n";
$headers .= "X-MSMail-Priority: High\r \n";
$headers .= "From: Batukaru Team <webmaster@batukaru.com>\r \n";
$headers .= "Bcc: webmaster@batukaru.com\r\n";
$headers .= "Content-Type: application/xls\r \n";
$headers .= "Content-Transfer-Encoding: base64\n";
$headers .= "Content-Disposition: attachment; filename=test.xls\r \n";
$path = "test.xls";
$fp = fopen($path, 'r');
do //we loop until there is no data left
{
$data = fread($fp, 8192);
if (strlen($data) == 0) break;
$content .= $data;
} while (true);
$content_encode = chunk_split(base64_encode($content));
$headers .= $content_encode . "\n";
$headers .= "--" . $boundary . "\n";
regards.
agung