I'm pretty new to PHP so don't mind the @
... was a quick fix for opening the script without errors
I'm currently working on a mail script and its working pretty well.
Sadly it sends the text the user enters as a .txt
file instead of plain text
Basically the form is stored in messenger_mailsend.php
and the content of the Textarea gets to messenger_mailsend_controller.php
by using $_POST[]
.
@$inhalt = $_POST['inhalt'];
$message = strip_tags($inhalt);
if(isset($_POST['submit'])){
@mail($mailto, $subject, 'why not zoidberg?', $headers);
echo 'The mail was sent!';
}
'why not zoidberg' is the test text i used to check if theres sth wrong with the var, actually it says mail($mailto, $subject, $message, $headers);
is the code I use to get the typed message from the form, remove the tags and store it as $message
.
If I do a var_dump
it says 'I am content' (what was typed in the form)..
when the $message
var is replaced by some plain text it still gets sent as TEXT.txt
The code i use for the $headers is:
$headers .= 'From:' . $usrmail . "
";
$headers .= 'Reply-To:' . $reply . "
";
$headers .= 'X-Mailer: PHP/' . phpversion() . "
";
$headers .= 'X-Sender-IP:' . $_SERVER['REMOTE_ADDR'] . "
";
$headers .= 'Content-type: text/html; charset=ISO-8859-1
';
$headers .= 'Cc: ' . $cc . "
";
$headers .= 'Bcc: ' . $bcc . "
";
-- Solution: By setting the content-type to text/plain it works, thanks anyone! --