Index: phpmailer.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/phpmailer/phpmailer.module,v
retrieving revision 1.19
diff -u -p -r1.19 phpmailer.module
--- phpmailer.module	21 Nov 2009 19:05:37 -0000	1.19
+++ phpmailer.module	10 Jan 2010 19:36:01 -0000
@@ -205,20 +205,30 @@ function phpmailer_disable() {
  */
 function phpmailer_load_library() {
   if (!class_exists('PHPMailer')) {
-    $phpmailer_library = './'. libraries_get_path('phpmailer') .'/class.phpmailer.php';
-    if (!file_exists($phpmailer_library)) {
-      // Provide backwards compatibility for existing installations of
-      // PHPMailer module.
-      $phpmailer_library = './'. drupal_get_path('module', 'phpmailer') .'/phpmailer/class.phpmailer.php';
-      if (!file_exists($phpmailer_library)) {
-        watchdog('phpmailer', 'Could not load PHPMailer library.', array(), WATCHDOG_ERROR);
-        return FALSE;
-      }
+    if (!($library_path = phpmailer_get_path())) {
+      watchdog('phpmailer', 'Could not load PHPMailer library.', array(), WATCHDOG_ERROR);
+      return FALSE;
     }
-    require_once $phpmailer_library;
+    require_once './'. $library_path .'/class.phpmailer.php';
   }
   if (!class_exists('DrupalPHPMailer')) {
     module_load_include('inc', 'phpmailer', 'includes/phpmailer.class');
   }
   return TRUE;
 }
+
+/**
+ * Get path to PHPMailer library.
+ */
+function phpmailer_get_path() {
+  $library_path = libraries_get_path('phpmailer');
+  if (!file_exists('./'. $library_path .'/class.phpmailer.php')) {
+    // Provide backwards compatibility for existing installations of
+    // PHPMailer module.
+    $library_path = drupal_get_path('module', 'phpmailer') .'/phpmailer';
+    if (!file_exists('./'. $library_path .'/class.phpmailer.php')) {
+      return FALSE;
+    }
+  }
+  return $library_path;
+}
Index: includes/phpmailer.class.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/phpmailer/includes/phpmailer.class.inc,v
retrieving revision 1.19
diff -u -p -r1.19 phpmailer.class.inc
--- includes/phpmailer.class.inc	9 Jan 2010 15:41:31 -0000	1.19
+++ includes/phpmailer.class.inc	10 Jan 2010 19:35:18 -0000
@@ -42,7 +42,7 @@ class DrupalPHPMailer extends PHPMailer 
     $this->SMTPDebug = variable_get('smtp_debug', 0);
 
     // Adjust path to SMTP class.
-    $this->PluginDir = './' . libraries_get_path('phpmailer') . '/';
+    $this->PluginDir = './'. phpmailer_get_path() .'/';
   }
 
   /**
