PHPMailer Fehler : Cannot redeclare...
Hat man in der aktuellen Drupal Version 6.17 für die Module Messaging und PHPmailer dieDateien class.phpmailer.php, class.pop3.php und class.smtp.php ins jeweilige phpmailer Verzeichnis entpackt (Download: http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/ ) so findet Drupal nur 1 dieser phpmailer-Ordner und wirft im Statusreport eine Fehlermeldung für den zweiten aus:
Hat man zusätzlich im Ordner sites/all/libraries/ ebenfalls diesen phpmailer-Ordner (was grundsätzlich keine schlechte Idee ist, da dadurch alle Module auf diese library zugreifen können) erhält man im Browser eine "Cannot redeclare..." Fehlermeldung. Dies kann man folgendermassen lösen:
In der Datei messaging/messaging_phpmailer/messaging_phpmailer.module wird folgender Part ab Line 122 auskommentiert um keine doppelte phpmailer_load_library Funktion zu nutzen (was diese Fehlermeldung erzeugt):
function messaging_phpmailer_load_library() {
if (!class_exists('PHPMailer')) {
// First, try using libraries module.
if (module_exists('libraries')) {
// Let's see if PHPMailer is really available from libraries.
$phpmailer_library = './'. libraries_get_path('phpmailer') .'/class.phpmailer.php';
if (file_exists($phpmailer_library)) {
include_once $phpmailer_library;
}
}
// If PHPMailer is not already loaded, then try from module subdirectory.
if (!class_exists('PHPMailer')) {
$phpmailer_library = './'. drupal_get_path('module', 'messaging_phpmailer') .'/PHPMailer/class.phpmailer.php';
if (file_exists($phpmailer_library)) {
include_once $phpmailer_library;
}
}
}
// Tell the caller if PHPMailer class exists.
return class_exists('PHPMailer');
}
und in der Datei messaging/messaging_phpmailer/messaging_phpmailer.install wird folgender Part ab Line 35 auskommentiert:
if (!messaging_phpmailer_load_library()) {
$requirements['messaging_html_mail'] = array(
'title' => $t('Messaging PHPMailer'),
'value' => $t('PHP Mailer missing'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('HTML Mail requires the <a href="http://phpmailer.codeworxtech.com/">PHP Mailer</a> class to properly send HTML Mail. Please download the 2.0 version and place the phpmailer folder in your messaging_phpmailer module directory. Rename the folder to "PHPMailer".'),
);
}
Jetzt können alle 3 phpmailer-Ordner dort bleiben wo sie sind und Drupal ist zufrieden ;)
Termine
| Mo | Di | Mi | Do | Fr | Sa | So |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 |

