Encountered Fatal error: Class 'PHPMailer' not found in C:\Documents and Settings\ ...user... \Sites\commerce_kickstart-7.x-2.5\sites\all\modules\phpmailer\includes\phpmailer.class.inc on line 12

Following 1) Clean install of Kickstart, 2) Enabling and configuring PHPMailer (no other changes made)

Class.phpmailer.php and class.smtp.php are installed in C:\Documents and Settings\ ...user... \Sites\commerce_kickstart-7.x-2.5\sites\all\libraries\phpmailer as directed by phpmailer readme.txt

Moving the files to the folder referenced by error message has no effect. Same results with php library release V5.1, V525 & V526.

As I understand it I need PHPMailer for html email support for Commerce however I've made no changesto the Commerce side of things at this stage. I get this error message on going to admin/config and modules so I cannot undo the change.

CommentFileSizeAuthor
#1 Image 001.png24.35 KBdrupauler
#1 Image 002.png13.61 KBdrupauler
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drupauler’s picture

Issue summary: View changes

spellcheck

drupauler’s picture

Issue summary: View changes

spellcheck

drupauler’s picture

FileSize
13.61 KB
24.35 KB

Attached are screenshots of phpmailer library install instructions and folders on target system. ((Ive just reproduced the problem using the standard acquia dev drupal dist drupal v7.22

oadaeh’s picture

Do you have the Libraries API module installed?

drupauler’s picture

Yes, it's a pre-req of PHPMailer; you cannot enable PHPMailer without it.

oadaeh’s picture

You can install drush (this is the Windows installer) to disable the module.

I can look at an installation I have on a Windows server to see what happens, but due to my schedule, it's not likely to happen today.

drupauler’s picture

Thanks. I'm at the sandbox stage playing with Commerce Kickstart. Ran a couple of test transactions and realised I needed to setup email and... ran into a brick wall. I'm using smtp with gmail.

drupauler’s picture

Looking again I getthe feeling the problem may relate to phpmailer having a bunch of 'module dependencies, although this is not immediately obvious (obvs) for SMTP Authentication, Mime Support, etc.

The problem is that right now, enabling PHPmailer immediately locks me out of the system and I cannot seem to disable it using Drush so investigating this is a bit of a problem.

That I can break the system so easily is surely 'bad'.

I must be missing something incredibly obvious on phpmailer, so if anybody has any favourite tutorials/examples on setting up and usinng Phpmailer let me know!

Paul

brunorios1’s picture

same here when enabled with "drush en"...

works ok when enabling via admin interface.

amcat’s picture

I have a similar problem and I can not get into PA:
Fatal error: Class 'PHPMailer' not found in /customers/8/e/e/.............de/httpd.www/sites/all/modules/phpmailer/includes/phpmailer.class.inc on line 12

amcat’s picture

Issue summary: View changes

do you know if you include text as "< text > " the editor drops it? I didnt

sahaj’s picture

Issue summary: View changes

Hi,
having the same issue here, installing phpmailer the same way as on other sites on a commerce kickstart project leading to this php fatal error.

Any insight?

wardevour’s picture

Has anyone found the answer? I've installed libraries API and PHPMailer like I always do and I get this same error. If I alter PHPMailer's code to include the two classes manually and put them in includes dir will it work? I feel like this is an issue with Libraries API...

gl2748’s picture

I am having the same issue site is WSOD.

Trying to 'drush dis phpmailer' 'drush en phpmailer' 'drush cc all' and any drush related commands gets.

Drush command terminated abnormally due to an unrecoverable error.                                                                   [error]
Error: Class 'PHPMailer' not found in /srv/www/drupal/sites/all/modules/phpmailer/includes/phpmailer.class.inc, line 12

The output from my site's error log at: /var/log/nginx/
tail mysite.com_error.log

2014/07/31 15:14:59 [error] 576#0: *856 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'PHPMailer' not found in /srv/www/drupal/sites/all/modules/phpmailer/includes/phpmailer.class.inc on line 12" while reading response header from upstream, client: XX.XXX.XXX.XXX, server: mysite.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/www55.fpm.sock:", host: "mysite.org"

My site is running in a docker container, could the issue be with symlinks similar and the solution similar to #6 here:
https://www.drupal.org/node/1534706

Thanks.

maynn123’s picture

Same issue. I've tried a lot of things and nothing happens. How come no one knows the answer? Ive seen so many issues on this with no clear solution :(

Anonymous’s picture

was about to try this module but thanks to everyone's comments i will stick to SMTP auth

dashohoxha’s picture

I had this error as well. But once I fixed the other Drupal errors, this one went away as well.
So, it seems to be caused by Drupal malfunctioning due to some other problems.

oadaeh’s picture

Thanks to dashohoxha posting, I'm looking at this issue again, and the error posted in #11 (which prompted me to re-read the description):

"PHP message: PHP Fatal error: Class 'PHPMailer' not found in /srv/www/drupal/sites/all/modules/phpmailer/includes/phpmailer.class.inc on line 12"

is for a file that comes with this module, i.e., it should be in the .tar.gz or .zip file you get from the download from https://www.drupal.org/project/phpmailer. It is not part of the PHPMailer library.

So, make sure that file is there and did not get moved or deleted.

There are different but very similar filenames, and they should be like so:
From this module (from here: https://www.drupal.org/project/phpmailer):

  • sites/all/modules/phpmailer/composer.json
  • sites/all/modules/phpmailer/phpmailer.admin.inc
  • sites/all/modules/phpmailer/phpmailer.info
  • sites/all/modules/phpmailer/phpmailer.install
  • sites/all/modules/phpmailer/phpmailer.module
  • sites/all/modules/phpmailer/README.txt
  • sites/all/modules/phpmailer/includes/phpmailer.class.inc
  • sites/all/modules/phpmailer/includes/phpmailer.drupal.inc
  • sites/all/modules/phpmailer/includes/phpmailer.mimemail.inc
  • sites/all/modules/phpmailer/tests/phpmailer.test

From the PHPMailer library (from here: https://github.com/PHPMailer/PHPMailer):

  • sites/all/libraries/phpmailer/class.phpmailer.php
  • sites/all/libraries/phpmailer/class.smtp.php
dashohoxha’s picture

It seems that Drupal is confused somehow (when something is not OK), and it fails to load the library file 'class.phpmailer.php'. As a result the class 'PHPMailer' is undefined and we get a PHP error.
Maybe this is related to the way that the library is loaded by the module, maybe it is a bit outdated or deprecated.

oadaeh’s picture

Category: Bug report » Support request
Status: Active » Closed (outdated)

I'm closing old issues. If this is still a problem, please reopen it with updated information.