I am having a problem with an email php form. When the user submits the form the email format doesn't come out right. I want it to be something like this:
Contact form below:
Name:
Surname:
email:
telephone:
message:
Using my code below the message comes from the user but with no line breaks. It comes as a straight line like: Contact form: Name: Surname: email: telephone: message:
<?php
$email_message .= "Όνομα: ".clean_string($first_name)."\r\n";
$email_message .= "Επώνυμο: ".clean_string($last_name)."\r\n";
$email_message .= "Email: ".clean_string($email_from)."\r\n";
$email_message .= "Τηλέφωνο: ".clean_string($telephone)."\r\n";
$email_message .= "Μήνυμα: ".clean_string($comments)."\r\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Content-type: text/html; charset=WINDOWS-1253;' . "\r\n" .
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
I found that if I remove the line with the content-type in the header the mail comes styled correctly but the characters are messed up because I am using the Greek alphabet.
If anyone can help me I would appreciate it a lot.
[EDIT] It seems all I needed to do was just use text as content type instead of text-html;
'Content-type: text; charset=WINDOWS-1253;' . "\r\n" .