Support » Plugin: WP Mail SMTP by WPForms » Uncaught Error: Class ‘SMTP’ not found in /usr/share/php/libphp-phpmailer/class

  • Resolved Rob


    Hello, the WP Mail plugin installation and configuration proceeds fine, but when I send the test email I get a php error /var/log/apache/error.log:

    Uncaught Error: Class ‘SMTP’ not found in /usr/share/php/libphp phpmailer/class.phpmailer.php:1495

    Machine detials: Debian 9.11, wordpress 4.7.14

    Googling around it seems that there is possibly some strange dependency ordering with the libphp-phpmailer debian package, and the phpmailer provided by wordpress. I haven’t found any solutions yet though.

    Does anyone have any advice or tips that I might try?



Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Slava Abakumov


    Hi Rob,

    There is a very similar issue here:
    That user had just to start with a fresh VM. Not a very helpful approach, but still.
    So in general, your WordPress installation is using phpmailer packaged with your server, and not with WordPress itself.
    PhpMailer class bundled with WP also has a reference to a SMTP class bundled with WP as well, so this is a dependency loading issue.
    You may want to try to install WP differently, not using Softacolous or similar tools (if you have any) – in a different directory.

    Plugin Support Sanjeev Aryal


    Hi @robscallsign – We haven’t heard from you in about a week, so I’m going to go ahead and mark this ticket resolved. If you still have questions, though, please feel welcome to continue the conversation.

    Hey guys,

    I have a similar issue to those above. I am running WordPress 4.9.12 on a VM and the installation included a global libphp-phpmailer package.

    Has there been a better work around other than starting again with a fresh VM or a new WordPress install?

    My error is:
    PHP Fatal error: Uncaught Error: Class ‘SMTP’ not found in /usr/share/php/libphp-phpmailer/class.phpmailer.php:1495

    I followed Slava’s advice and attempted to remove the package with:
    sudo apt-get remove libphp-phpmailer

    However it the info after the command told me that WordPress would be removed also so I did not remove it.

    I renamed it and received this error:
    PHP Fatal error: require_once(): Failed opening required ‘/usr/share/php/libphp-phpmailer/class.phpmailer.php’ (include_path=’.:/usr/share/php’) in /usr/share/wordpress/wp-content/plugins/wp-mail-smtp/src/MailCatcher.php on line 7

    I then tracked down the specific line hoping to change the path to

    But received the same error (move down 2 lines with comments):
    Fatal error: require_once(): Failed opening required ‘/usr/share/wordpress/wp-includes/class-phpmailer.php’ (include_path=’.:/usr/share/php’) in /usr/share/wordpress/wp-content/plugins/wp-mail-smtp/src/MailCatcher.php on line 9

    Running on a Ubuntu 18.04 instance with ID_LIKE=debian

    Any work around would be very helpful,



    Just in case anyone else has issues with this, I have resolved the issue on my end. Although I can only speculate on its cause. The class.phpmailer.php in the libphp-phpmailer package and the class-phpmailer.php inside the wp-includes folder were identical and both threw the error at this function:

    public function getSMTPInstance()
    if (!is_object($this->smtp)) {
    $this->smtp = new SMTP;
    return $this->smtp;

    Upon looking up class-phpmailer.php on the official WordPress github I noticed there was a new line of code in the function.

    public function getSMTPInstance()
    if (!is_object($this->smtp)) {
    require_once( ‘class-smtp.php’ ); <–
    $this->smtp = new SMTP;
    return $this->smtp;

    I have since added the line of code within my class.phpmailer.php inside my ibphp-phpmailer package and changed the name to class.smtp.php to match that within the package and my email test just succeed.

    Plugin Author Jared Atchison


    Thank you @mgtri for reporting back with your findings, very much appreciated!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Uncaught Error: Class ‘SMTP’ not found in /usr/share/php/libphp-phpmailer/class’ is closed to new replies.