Reputation: 15
The HTML code is this
<form class="rnd5" action="mail.php" method="post">
<div class="form-input clear">
<label for="name">Nume <span class="required">*</span><br>
<input type="text" name="name" id="name" value="" size="22">
</label>
<label for="email">Email <span class="required">*</span><br>
<input type="text" name="email" id="email" value="" size="22">
</label>
</div>
<div class="form-message">
<textarea name="message" id="message" cols="25" rows="10"></textarea>
</div>
<p>
<input type="submit" value="Submit" class="button small orange">
<input type="reset" value="Reset" class="button small grey">
</p>
</form>
And the php code is this one :
<?php $name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "[email protected]";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>
But it doesnt work.... i don't know what to do , i need some help here please.
Upvotes: 0
Views: 75
Reputation: 217
If messages are not received, try using a LF (\n) only. Some Unix mail transfer agents (most notably » qmail) replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with » RFC 2822.
Source: http://php.net/manual/en/function.mail.php
In your case, neither \r\n nor \n is needed as you're only using a single extra header.
Upvotes: 1