Re: [HTML MAIL FORM] - Body text not coming through
| From: | Al | Date: | Sun, 20 Jul 2008 20:25:53 +0000 |
| Subject: | Re: [HTML MAIL FORM] - Body text not coming through | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-277128@lists.php.net to get a copy of this message | ||
Consider using PEAR Mail_Mime or Mail_mimePart.
Works well and is easy to use.
TS wrote:
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: <20080720000110.13638.qmail@somedomain.com> To: tom@cleargraphix.com Subject: From: <somone@somedomain.com> 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 usedfor 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";