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
Made a patch for this against the dev version. Might work for regular version too.
#2
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
tagging