Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP

Jeff Lemay
Jeff Lemay
14,266 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,266 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.