How do I control the "From" field with email sent from a web site using PHP?

  • Thread starter Thread starter zachtwalsh
  • Start date Start date
Z

zachtwalsh

Guest
I have a contact form on my web site that works flawlessly accept for one thing. When it shows up in my email inbox the from field says the server name. How can I customize that part to say my name or anything else?
 
If you're using the php mail() function, pass a From header with fourth parameter.

ex.

$header = "From: <place the value here>";

mail($to, $subject, $body, $header);
 
Back
Top