Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Simple PHP Application Wrapping Up The Project Sending The Contact Form Email

Is it not bad practice to send an email using the user specified FROM address.

If you send a message (even to yourself) using a FROM address which is user specified then the message could be flagged as spam by the receiving server. AntiSPAM mechanisms such as SPF (Sender Policy Framework) can specify which servers are authorized to send mail for a particular domain. If your message is sent by your webserver then this server is NOT going to be on the authorized list and could be flagged as SPAM. Surely the FROM address should be something like webserver@serverdomain.com and the AddReplyTo method can then be used to set the ReplyTo address to the user submitted address so that it can be replied to.

No, best practice is to use the user specified email address.

Why?... Well let's say the serverdomain.com domain is blacklisted. The AntiSPAM mechanisms will block emails from this domain. Where I work we recently had this exact problem where one of our servers became black listed and AntiSPAM was blocking form submissions because they were coming from domain names on the server. I would say it's best practice to always use the email address specified by the user.