Php email headers - best pratice


When sending email from a contact form on a web app, headers must be set.

I’ve read that your email can be flagged as spam if the “from” header is not the same as the domain name.

What is the best practice with regards to sending email from contact forms and headers?

Should the FROM header be say “” and then set the REPLYTO header as “”?

I ask in that if you set the FROM header to be your domain, then a client may receive an email, click reply out of habit, and send an email back to the domain, rather than the person who made the enquiry

hope this was clear


An email is flagged on several parameters - See some sys-admin’s doc on how to flag emails as possible spams.

If possible, do not modify the “from” header. Keep the reply-to to the same.
Do not generate emails as if they are generated from big networks, like hotmail or gmail networks.

Keep pain-text and part and html-part in high ratio (use less html parts).

Avoid attaching zip, js, bat, exe, com, sh like files. Review the policies of your recipient’s domain - how they process the emails received before your user gets them.

Ask your customers to white-list your email-domain.
This is one best practice to get emails delivered. (unless you are spamming…)

You can safely put from/to/reply-to emails differently - without being marked as spam, if your email qualifies not to be a possible spam.

Always test before sending an email that your email reaches the inbox of the big-networks. People who use outlook express like email clients and company’s own domain, can reach your emails safely.