HTML email attachments arrive as text
Posted: Wed Apr 16, 2003 8:52 am
I have some code that is supposed to retrieve information from a database, put it into an HTML page and email the entire HTML page as an attachment. Most of the code works fine except that the attachment arrives as ATT000054.txt or something similar instead of filename.htm which is what I want. The first few lines of the attachment contain the following:
Content-Type: text/html;
name="filename.html"
Content-Disposition: attachment;
filename="filename.html"
Content-Transfer-Encoding: 7bit
followed by the HTML.
Part of the code that sends the message is as follows:
$comments diplays in the body of the email as plain text which is what I want.
Has anybody got any idea what I've done wrong?
Content-Type: text/html;
name="filename.html"
Content-Disposition: attachment;
filename="filename.html"
Content-Transfer-Encoding: 7bit
followed by the HTML.
Part of the code that sends the message is as follows:
Code: Select all
headers = "From: $candidate_rowїfirst]$candidate_rowїlast]<$result_persїemail]>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Return-Path: <webmaster@somedomain.com>\n";
$headers .= "Content-Type: multipart/mixed;\n\t boundary="==adrufhyrtdsvvh=="\n";
$message = "This is a multipart message in MIME format.\n";
$message .= "--==adrufhyrtdsvvh==
$comments
--==adrufhyrtdsvvh==
Content-Type: text/html;\n\tname="$file_att"
Content-Disposition: attachment;\n\tfilename="$file_att"
Content-Transfer-Encoding: 7bit
$file_content
--==adrufhyrtdsvvh==--";
mail($to, $subject, $message, $headers);Has anybody got any idea what I've done wrong?