Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/phpmailer/README.txt,v
retrieving revision 1.8
diff -u -p -r1.8 README.txt
--- README.txt	18 Jun 2009 15:09:25 -0000	1.8
+++ README.txt	30 Aug 2009 19:02:52 -0000
@@ -14,6 +14,9 @@ To submit bug reports and feature sugges
 
 * Access to an SMTP server
 
+* Libraries API module
+  http://drupal.org/project/libraries
+
 * PHPMailer for PHP5/6
   http://phpmailer.codeworxtech.com
 
@@ -35,14 +38,22 @@ Optional:
 
      http://sourceforge.net/project/showfiles.php?group_id=26031&package_id=252700
 
-   and extract the the following files to the subdirectory 'phpmailer' of this
-   module:
+   and extract the following files to the phpmailer subdirectory of your
+   libraries directory:
 
      class.phpmailer.php
      class.smtp.php
- 
+
    Be careful NOT to extract the path names contained in the archive.
 
+   You can create your libraries directory to any of the following locations:
+
+     profiles/profile/libraries
+     sites/all/libraries
+     sites/<domain>/libraries
+
+   Please, consult the Libraries API documentation for further information.
+
 2. Install as usual, see http://drupal.org/node/70151 for further information.
 
 
Index: phpmailer.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/phpmailer/phpmailer.info,v
retrieving revision 1.3
diff -u -p -r1.3 phpmailer.info
--- phpmailer.info	16 Jan 2009 17:36:54 -0000	1.3
+++ phpmailer.info	30 Aug 2009 18:40:32 -0000
@@ -1,5 +1,6 @@
 ; $Id: phpmailer.info,v 1.3 2009/01/16 17:36:54 smk Exp $
 name = PHPMailer
 description = Integrates PHPMailer with Drupal.
+dependencies[] = libraries
 package = Mail
 core = 6.x
\ No newline at end of file
Index: phpmailer.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/phpmailer/phpmailer.install,v
retrieving revision 1.1
diff -u -p -r1.1 phpmailer.install
--- phpmailer.install	7 May 2009 04:33:19 -0000	1.1
+++ phpmailer.install	30 Aug 2009 19:03:52 -0000
@@ -25,3 +25,29 @@ function phpmailer_uninstall() {
   variable_del('smtp_debug');
 }
 
+/**
+ * Implementation of hook_requirements().
+ */
+function phpmailer_requirements($phase) {
+  $requirements = array();
+  // Ensure translations don't break at install time.
+  $t = get_t();
+
+  if ($phase == 'runtime') {
+    $phpmailer_path = libraries_get_path('phpmailer');
+
+    if (!file_exists('./'. $phpmailer_path .'/class.phpmailer.php')) {
+      $requirements['phpmailer'] = array(
+        'title' => $t('PHPMailer'),
+        'value' => $t('PHP Mailer library missing'),
+        'severity' => REQUIREMENT_ERROR,
+        'description' => $t('PHPMailer module requires the <a href="@phpmailer-url">PHP Mailer</a> class to properly send mail. Please download the PHPMailer package for PHP5/6, extract the archive and copy its contents into a new folder in the following location: @phpmailer-path. Make sure the main PHPMailer class is located at @phpmailer-class-path.', array(
+          '@phpmailer-url' => 'http://sourceforge.net/project/showfiles.php?group_id=26031&package_id=252700',
+          '@phpmailer-path' => $phpmailer_path,
+          '@phpmailer-class-path' => $phpmailer_path .'/class.phpmailer.php',
+        )),
+      );
+    }
+  }
+  return $requirements;
+}
Index: phpmailer.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/phpmailer/phpmailer.module,v
retrieving revision 1.4
diff -u -p -r1.4 phpmailer.module
--- phpmailer.module	7 May 2009 04:33:19 -0000	1.4
+++ phpmailer.module	30 Aug 2009 18:34:53 -0000
@@ -171,3 +171,19 @@ function phpmailer_preview() {
   exit;
 }
 
+/**
+ * Load PHPMailer class from libraries path.
+ */
+function phpmailer_load_library() {
+  if (!class_exists('PHPMailer')) {
+    $phpmailer_library = './'. libraries_get_path('phpmailer') .'/class.phpmailer.php';
+    if (!file_exists($phpmailer_library)) {
+      return FALSE;
+    }
+    require_once $phpmailer_library;
+  }
+  if (!class_exits('DrupalPHPMailer')) {
+    module_load_include('inc', 'phpmailer', 'includes/phpmailer.class');
+  }
+  return TRUE;
+}
cvs diff: Diffing includes
Index: includes/phpmailer.class.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/phpmailer/includes/phpmailer.class.inc,v
retrieving revision 1.8
diff -u -p -r1.8 phpmailer.class.inc
--- includes/phpmailer.class.inc	10 Jun 2009 13:27:04 -0000	1.8
+++ includes/phpmailer.class.inc	30 Aug 2009 18:33:40 -0000
@@ -6,8 +6,6 @@
  * Implements the base PHPMailer for Drupal class.
  */
 
-module_load_include('php', 'phpmailer', 'phpmailer/class.phpmailer');
-
 /**
  * Base PHPMailer for Drupal implementation with support for SMTP keep-alive
  * and setting a custom Return-Path.
Index: includes/phpmailer.drupal.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/phpmailer/includes/phpmailer.drupal.inc,v
retrieving revision 1.6
diff -u -p -r1.6 phpmailer.drupal.inc
--- includes/phpmailer.drupal.inc	10 Jun 2009 13:07:28 -0000	1.6
+++ includes/phpmailer.drupal.inc	30 Aug 2009 18:38:16 -0000
@@ -6,8 +6,6 @@
  * Implements PHPMailer support on behalf of Drupal core.
  */
 
-module_load_include('inc', 'phpmailer', 'includes/phpmailer.class');
-
 /**
  * Send out an e-mail.
  *
@@ -18,6 +16,10 @@ function phpmailer_send($message) {
   static $mail;
 
   if (!isset($mail)) {
+    if (!phpmailer_load_library()) {
+      watchdog('phpmailer', 'Could not load PHPMailer library.', NULL, WATCHDOG_ERROR);
+      return FALSE;
+    }
     $mail = new DrupalPHPMailer();
   }
 
Index: includes/phpmailer.mimemail.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/phpmailer/includes/phpmailer.mimemail.inc,v
retrieving revision 1.4
diff -u -p -r1.4 phpmailer.mimemail.inc
--- includes/phpmailer.mimemail.inc	7 May 2009 04:33:19 -0000	1.4
+++ includes/phpmailer.mimemail.inc	30 Aug 2009 18:38:06 -0000
@@ -6,8 +6,6 @@
  * Implements PHPMailer support on behalf of Mime Mail module.
  */
 
-module_load_include('inc', 'phpmailer', 'includes/phpmailer.class');
-
 /**
  * Send out an e-mail.
  *
@@ -18,6 +16,10 @@ function mimemail_phpmailer_send($messag
   static $mail;
 
   if (!isset($mail)) {
+    if (!phpmailer_load_library()) {
+      watchdog('phpmailer', 'Could not load PHPMailer library.', NULL, WATCHDOG_ERROR);
+      return FALSE;
+    }
     $mail = new DrupalPHPMailer();
     // Keep linefeed style in sync.
     $mail->LE = variable_get('mimemail_crlf', "\n");
