PHP mail submissions not working
Hey, i created this simple email form that uses php to send me the email, however, I don't receive the emails. I typed and re-typed everything over again to make sure I got it, but nothing! Would you please take a look and see if there's anything wrong with my code?
sendmail.php:
<?php
$email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ;
mail( "myemailaddress@something.com", "Subject", $message, "From: $email" ); header( "Location: nextpage.html" ); ?>
The Form (contact.html):
<form action="sendmail.php" method="post"> Email <input type="text" name="email" value="" /><br /> Message <textarea name="message" value="" /><br /> <input type="submit" value="Send" /> </form>
At some webbservers I've heard they request a sender mail-adress witch u send in a header like this:
$headers = "From: '.$email.' <'.$email.'>\r\n";
Then send the mail like this:
mail($to, $subject, $message, $headers);
Dont know if it makes any difference but it might bee worth a try.
<?php
$to="domain@email.com"; //recievers email
$subject="this is an email"; //email subject
$body="blah blah blah"; //main body of the message
$header="From: sender@email.com\n"; //the email you wish to send from
mail($to,$subject,$body,$header);
echo "Your email was sent to $to $header";
?>