The best way to handle your problem is to create the $headers variable then insert it into the mail function. This will fix your problem and allow further custimization in the future should it be needed.
$headers='From: $email';
mail("myemail@domain.com, myemail2@domain.com","Form submitted at your website",$message,$headers)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm having a problem getting the "From" in the email header to be anything except my server.
Here is my code:
mail("myemail@domain.com, myemail2@domain.com","Form submitted at your website",$message,$email)
So the email is coming "nobody@myserver.com" and it puts the $email info in the message body at the top.
Thanks.
The mail function has specific requirements.
http://us3.php.net/manual/en/function.mail.php
Basically:
mail($to, $subject, $message, $headers);
The best way to handle your problem is to create the $headers variable then insert it into the mail function. This will fix your problem and allow further custimization in the future should it be needed.
$headers='From: $email';
mail("myemail@domain.com, myemail2@domain.com","Form submitted at your website",$message,$headers)