PHPMailer class could already be defined

batje - August 6, 2009 - 16:36
Project:SMTP Authentication Support
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Issue tags:Libraries
Description

We are using this module and the phpmailer module that is implemented by the http://drupal.org/project/messaging class. There are scenarios (especially during running cron) that the other module loads the PHPMailer class first.

Here is how to prevent that:

  // Include the PHPMailer class (which includes the SMTP class).
  if (!class_exists('PHPMailer')) {
    require_once(drupal_get_path('module', 'smtp') .'/phpmailer/class.phpmailer.php');
  }

#1

jdwfly - September 11, 2009 - 19:06
Version:6.x-1.0-beta3» 6.x-1.x-dev

Made a patch for this against the dev version. Might work for regular version too.

AttachmentSize
smtp-541942.patch 787 bytes

#2

markus_petrux - September 24, 2009 - 08:28

Related issue in the messaging module queue: #541938: using PHPMailer twice crashes messaging_mailer

SMTP could also try first using libraries module. See the patch attached in the above mentioned issue.

That way, sites using SMTP with no other module loading PHPMailer class may take advantage of libraries. ie. the class could be installed out side the module directory, which makes upgrades a lot easier. And here's a good reason to keep 3rd party libraries off the modules directories: #546584: allow to exclude folders from drupal_system_listing. ie. less subdirectories under modules directory means less job for drupal_system_listing().

#3

markus_petrux - September 24, 2009 - 18:49

tagging

 
 

Drupal is a registered trademark of Dries Buytaert.