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

Jeff Lemay
Jeff Lemay
14,268 Points

Website form works perfectly when made live, but stops sending after a couple hours

Hello Treehouse World! Thank you in advance for your insights.

I have a website form that works perfectly when I test it right after making it live. The email is sent successfully and everything works as expected. But when I go back to try the form again after a few hours/days, the form will not send an email. The weird thing is, I can upload a random test file to my server (completely unconnected to the form itself), and then the form will start working again. It's like the server is frozen until I upload or change the files on the server.

I can't comprehend why unchanged code would work, stop working, and then work again. Is it an issue with the site's server? the FTP client? the code?

Any help is greatly appreciated!

1 Answer

James Barnett
James Barnett
39,199 Points

Sounds like the mail server you are using rate-limiting and perhaps you are exceeding that limit and then they are soft banning you for a few hours.

I'd check with them on what the best way to use their mail server with your script is.

Update: I wonder are you using Heroku, if you only have 1 dyno (the Free plan) and your site doesn't have any traffic it goes to sleep.

Jeff Lemay
Jeff Lemay
14,268 Points

Hi James, thank you for the response. UPDATED: My site is hosted on DreamHost. Everything was created based on what I learned here at Treehouse; PHPMailer and a similar form-process to the one you all taught.

I'm going to contact ASO support and see what their thoughts are.