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 trialStephanie Roberts
16,757 PointsContact form is sending to gmail spam folder
I have recently created a contact form in PHP and it sends the message fine, but it is sending it to my spam folder in my gmail. I am using php mailer.
Does anyone know why it's doing this?
3 Answers
Greg Kaleka
39,021 PointsHi Stephanie,
If you're using a shared host to host your website, this could be the reason, as the server you're on may have some spammy sites on it. You have a couple of options.
- Since you're only using your contact form to send emails to yourself, you can simply mark those emails as not spam, and even set up a rule in Gmail to ensure you get those messages in your inbox, perhaps with a label as well.
- Use a 3rd party mail service like mailgun. They have a nice API and it wouldn't be too hard to use it on your site using PHP. Their documentation is good.
Good luck!
-Greg
Emmanuel Plouvier
11,919 PointsHi,
This is often of mail heading problem or with the "reputation" of your server.
To know more, you can read :
Devron Baldwin
3,508 PointsIn my experience it's generally the SPF record being set up incorrectly.
Stephanie Roberts
16,757 PointsThanks for your help Greg, I will take your advice on board and look into this,