This is my PHP script for sending email:
function submitEmail($userName, $userEmail, $userMessage) {
$mailto = "<someone>@gmail.com";
$subject = "Message from my website";
$headers = "From: $userName <$userEmail>\n" .
"Return-Path: $userEmail\n" .
"MIME-Version: 1.0\n" .
"Content-Type: Content-type: text/html; charset=iso-8859-1\n";
mail($mailto, $subject, $userMessage, $headers);
echo "<script>alert('Your message has been successfully delivered.');</script>";
}
I successfully recieve email when using it, however not in the format that I would prefer. The $userMessage is put inside an unnamed attachment, which I must open with a text editor to read.
I want the $userMessage to appear as text within the mail itself, not as an attachement. It does this if I remove the entire $headers variable, however I would prefer to keep it, and figure I'll need to modify it in some way.
Any advice is appreciated.