email attach and contain message together

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>\r \n";
 $headers .= "Bcc: webmaster@xxxxxxxxxxxx\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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux