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

WordPress How to Install WordPress on Your Computer How to Install WordPress on Your Computer How to Enable Email for WordPress on Your Computer

Daniel Schroeder
Daniel Schroeder
13,859 Points

Test Email throws PHP Errors: Class SMTP Not Found

I'm just setting up WordPress to run on Ubuntu 16.04 and had the following error message popup when I tried to send a test email (through my gmail account) from EASY WP SMTP:

( ! ) Fatal error: Uncaught Error: Class 'SMTP' not found in /usr/share/php/libphp-phpmailer/class.phpmailer.php on line 1446
( ! ) Error: Class 'SMTP' not found in /usr/share/php/libphp-phpmailer/class.phpmailer.php on line 1446
Call Stack

I checked /usr/share/php/libphp-phpmailer/ and there was definitely a class.smtp.php in there, so I have no idea why this error is occurred. I decided to just include the class.smtp.php in the class.phpmailer.php file by adding this line to /usr/share/php/libphp-phpmailer/class.phpmailer.php and it fixed the issue:

include 'class.smtp.php';

I'm a novice PHP user, and brand new to WordPress, so can anyone explain why this issue occurred in the first place? Why can class.phpmailer.php not find class.smtp.php if they are both in the same package and directory? Why is the include statement needed?