So when I tested before my boundaries were wrong in my code. It however was
copied into this email message correctly in the code below below.
This was " boundary=\"--{$mime_boundary}\"";
" boundary=\"{$mime_boundary}\"";
Notice the double dashes were missing so, when they were added it now works
but, all the header info is now showing in the message body. Any ideas?
Thanks
From: TS [mailto:[EMAIL PROTECTED]
Sent: Sunday, July 20, 2008 1:36 PM
To: '[email protected]'
Subject: [HTML MAIL FORM] - Body text not coming through
Can someone spot what I'm doing wrong here? Must have something to do with
headers maybe?
The attached picture comes through but, no text. Here's the headers that do
come through. Thanks for any help. Mail is such a pain.
Received: (qmail 13640 invoked by uid 48); 19 Jul 2008 17:01:10 -0700
Date: 19 Jul 2008 17:01:10 -0700
Message-ID: <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject:
From: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="==Multipart_Boundary_x8588974b51cbb9c326958df4c2f8b218x"
$fileatt = "test-send.jpg"; // Path to the file
$fileatt_type = "application/octet-stream"; // File Type
$fileatt_name = "picture.jpg"; // Filename that will be used
for the file as the attachment
$headers = "From: ".$_REQUEST['first_name']."
<".$_REQUEST['from'].">";
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
"
boundary=\"--{$mime_boundary}\"";
$body .= "Text that should show up but, I'm a noob.\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$body . "\n\n";
$data = chunk_split(base64_encode($data));
$body .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
@mail($toEmail, $subject, $body, $headers);
echo "sent=OK";