[thelist] PHP4 HTML Email
Peter Atkins
Peter.Atkins at nextcard.com
Sat Feb 2 13:31:00 CST 2002
All,
I'm building a tool that takes form input and sends out an html email with a
word doc attached.
It sends the text and html version of the email but I can't open the
attachment. It opens blank.
Anyone have a thought or two about this?
<php snippet>
if ($attachment) {
$fp = fopen($attachment, "rb");
$data = fread($fp, filesize($attachment));
$data = chunk_split(base64_encode($data));
fclose($fp);
// add the MIME data
$str .= "--" . $boundary . "\r\n";
$str .= "Content-Type: application/octet-stream; name=\"" .
$attachment ."\"\r\n";
$str .= "Content-Transfer-Encoding: base64\r\n";
$str .= "Content-Disposition: attachment; filename=\"" . $attachment
."\"\r\n\r\n";
$str .= $data . "\r\n";
}
</php snippet>
thanks,
-p
More information about the thelist
mailing list