This is driving me nuts and i think I just need a fresh set of eyes to look at this.... Basically I have a script that is grabbing data from the form, and the file (if attached) and doing the email (without spam) All seems to be good. The part I cant get figured out is the $message. I've done something wrong and it's driving me nuts. I have a ton of post variables that need to be filled into the email that get sent with the attachment (if there is one) And when I receive the email I am getting the special characters like \n or \t Im trying to get it do list my vars nicely: Name: John Doe Email: Address: 123 main st And so on... Heres my form code on the receiving end: // Generate a boundary string $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // Add the headers for a file attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/alternative;\n" . " boundary=\"{$mime_boundary}\""; // Add a multipart boundary above the plain message $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: multipart/mixed; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n " . $message . "\n\n"; // Base64 encode the file data $data = chunk_split(base64_encode($data)); // Add file attachment to the message $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; } // Send the message $ok = @mail($to, $subject, $message, $headers); PHP: My outbound messages (from the form) are: enctype="multipart/form-data" So I am not sure whats going on - can anyone tell me where im FUDGING UP?
Does this default to a HTML email when in multi mode, so you would need to use nl2br() on the message to convert \n etc to <br> this way the email would be formatted correctly.
From your site. <br>test\n\ntest thats what i get in the email.... IM ABOUT READY TO KICK MY STUPID COMPUTER!
$message = 'From your site. ' . '<br>' . 'test'. '\n\n' . 'test'; Thats what produced me the above example I was trying to format $message before it was called. Instead I am still getting the same results.... Bonkers anyone?! (BOING BOING BOING!)