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
Justin Esders
9,154 PointsPHP Contact Form Mailer Problem
I have been following the series of videos on here in php and cant figure out why i keep getting this error. Can someone help
There was a problem sending the email: Could not instantiate mail function.
1 Answer
Randy Hoyt
Treehouse Guest TeacherIt sounds like your server does not have the mail() function available. You'll probably need to use SMTP. Your host probably has an SMTP server set up; I would contact them and ask for information. PHPMailer can be configured to use SMTP; it comes with an example in the download or you can take a look at my blog post: Sending Email With PHPMailer and SMTP.
Does that help?
ricardogutierrez
11,349 Pointsricardogutierrez
11,349 PointsHi Randy.
When I submit the information it gives me an error. Is this message an SMTP problem also?:
"Fatal error: Class 'PHPMailer' not found in /home2/sitename/public_html/php/contact-process.php on line 34"
The files are uploaded to my server and I am just using the "default" server configuration.
The website is http://ultraloud.net
:) ... thanks.
Randy Hoyt
Treehouse Guest TeacherRandy Hoyt
Treehouse Guest TeacherIf the PHPMailer class isn't found, that means you are not including the third-party library correctly. Double-check your
require()command and the path.Does that help?
ricardogutierrez
11,349 Pointsricardogutierrez
11,349 PointsThank you very much Randy ! yes ... the path was the problem.
Succesfully send email and receive the information :D.
My first formulary !!! yayyyyy !!!
By the way... do you know about the htmlspecialchars() ? I have read about it but not to sure how to implement this. Is necessary to include it for security?
Thanks a lot !!!
Randy Hoyt
Treehouse Guest TeacherRandy Hoyt
Treehouse Guest TeacherGlad you got it working!
I cover
htmlspecialcharsin the next course, in the Integrating Validation Errors badge. I explain there how it works and when you would want to use it.ricardogutierrez
11,349 Pointsricardogutierrez
11,349 PointsOh great !
I'll check it right now.