Hi,

I cannot get a pdf attachment to a multi-part MIME email message working.
The pdf document ends up not being able to be read by Acrobat reader, and
when inspected with notepad, the file appears to be shorter than the
original. My code is:

$file_url = "//asb-intranet/c$/tempuserfiles/PO-phodd-105457.pdf";
SendAttachment($file_url);

function SendAttachment($file_url) {
 //header
 $headers .= "MIME-Version: 1.0\n";
 $headers .= "Content-Type: multipart/mixed; boundary=\"MIME_BOUNDRY\"\n";
 $headers .= "This is a multi-part message in MIME format.\n";
 //message
 $message = "--MIME_BOUNDRY\n";
 $message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
 $message .= "\n\nYour purchase order is attached.\n";
 $message .= "\n";
 $message .= "--MIME_BOUNDRY\n";
 $message .= "Content-Type: application/pdf; name=\"PO.pdf\"\n";
 $message .= "Content-disposition: attachment\n";
 $message .= "Content-Transfer-Encoding: base64\n";
 $message .= "\n";
 $fp = fopen($file_url,"r");
 $str = fread($fp, filesize($file_url));
 $str = chunk_split(base64_encode($str));
 $message .= "$str\n";
 $message .= "\n";
 //message ends
 $message .= "--MIME_BOUNDRY--\n";
 mail("[EMAIL PROTECTED]","Purchase Order",$message,$headers); 
}

Any ideas to help me?

Regards,

Peter Hodd

Watercare Services Limited uses the Microsoft Office 2000 suite of
applications.  It is recommended that any files sent to us are
compatible with these applications.


######################################################################
Disclaimer:

This e-mail message and any attachments is privileged and confidential.
It may contain information that is subject to statutory restrictions on
its use.

If you are not the intended recipient, you must not peruse, use, pass
on or copy this message or its attachments. If you have received this
message in error, please advise us by return e-mail, and delete the
message and attachments from your system. 

This e-mail has been scanned and cleared by MailMarshal 
www.marshalsoftware.com
######################################################################

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

Reply via email to