I'm having a bit of a nightmare getting a form to html email working properly.
There are up to 5 uploads allowed by the form, although at the moment I'm only trying to process one until I get that working.
Here's the the necessary code excerpts - the first part of the message works fine.
//unique ID for the email boundaries
$subject="Form Submitted Online";
$headers="From: "."Joe Bloggs"." <"."email@example.com".">\\r\
$headers.="Reply-To: ". "firstname.lastname@example.org" . "\\r\
$headers.="Content-Type: multipart/mixed; boundary=\\"$uid\\"";
//build the HTML message section
$message.= "If you can see this MIME than your client doesn't accept MIME types!\\r\
$message .= "Content-Type: text/html; charset=\\"iso-8859-1\\"\\r\
//Process the file uploads
//This is working and copying successfully into the uploads directory
//headers for the email attachment
$message.="Content-Type: ".'image/jpg'."; name=\\"".$name_of_uploaded_file."\\"\\r\
$message.="Content-Disposition: attachment; filename=".'"'.$name_of_uploaded_file.'"'."\\r\
mail ($recipient, $subject, $message, $headers);
When I run the script the email comes through. The html bit is fine but is followed by the attachment contents in a huge chunk of ascii text underneath the html, rather than as a file attachment.
I hope I'm doing something simple wrong but have been trying loads of tweaks from different tutorials, none of which are helping.
In case it's relevant I'm on Outlook 2003 but have also checked via webmail and getting the same results.
Many thanks in advance for any assistance.