function messaging_phpmailer_load_library in Messaging 6.3
Same name and namespace in other branches
- 6.4 messaging_phpmailer/messaging_phpmailer.module \messaging_phpmailer_load_library()
- 6.2 messaging_phpmailer/messaging_phpmailer.module \messaging_phpmailer_load_library()
Load the PHPMailer library.
Return value
TRUE if the PHPMailer library is loaded, FALSE otherwise.
2 calls to messaging_phpmailer_load_library()
- messaging_phpmailer_drupal_mail in messaging_phpmailer/
messaging_phpmailer.module - Send a message via PHPMailer. This function mimics drupal_mail. We do not use drupal_mail instead because we want to be able to send mail with both PHPMailer and MIMEMail.
- messaging_phpmailer_requirements in messaging_phpmailer/
messaging_phpmailer.install - Implementation of hook_requirements().
File
- messaging_phpmailer/
messaging_phpmailer.module, line 122 - HTML Mail using PHPMailer. Messaging method plug-in.
Code
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');
}