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

Toby`` Wilkinson
Toby`` Wilkinson
2,009 Points

Setting an Error Message Variable Heres a Fix for the php mail library

As you may notice with the new stable version of the PHPMailer library that came out recently. You may get a file doesn't exist error something like this:

Warning: require(PHPMailerAutoload.php): failed to open stream: No such file or directory in C:\wamp\www\include\phpmailer\class.phpmailer.php on line 571

if you open up the class.phpmailer.php to line 571, you will notice that phpmailer is now separated into two files now.

public function __construct($exceptions = false) { $this->exceptions = ($exceptions == true); //Make sure our autoloader is loaded if (version_compare(PHP_VERSION, '5.1.2', '>=') and !spl_autoload_functions() || !in_array('PHPMailerAutoload', spl_autoload_functions())) { require 'PHPMailerAutoload.php'; } }

The extra file you need to overcome this error is: PHPMailerAutoload.php Once you add this file into the same place as class.phpmailer.php the error will go away and you can continue the php course.

It would be good if Randy could re word what I just said for everyone else.

  • Yours Toby