diff --git a/INSTALL.TXT b/INSTALL.TXT
index 06987c4..cb24de7 100644
--- a/INSTALL.TXT
+++ b/INSTALL.TXT
@@ -24,6 +24,8 @@ INSTALLATION INSTRUCTIONS:
 
 * Download and unpack the latest PHPMailer 5.x then move the library to og_mailinglist/phpmailer or to libraries/phpmailer if you use the libraries module - http://kent.dl.sourceforge.net/project/phpmailer/phpmailer%20for%20php5_6/PHPMailer%20v5.1/PHPMailer_v5.1.tar.gz 
 
+* Apply the patch phpmailer.patch (found in the top level of the og_mailinglist package) to the phpmailer directory. This fixes some issues in the PHPMailer library, allowing og_mailinglist to override message dates and recipients.
+
 * Install the PHP library mimeDecode. On Debian/Ubuntu run from the command line, "apt-get install php-mail-mimedecode". You can also download the file directly from http://pear.php.net/package/Mail_mimeDecode and add the file either as a subdirectory to og_mailinglist or to the libraries folder. Note, mimeDecode depends on PHP PEAR, which sould be installed on any recent install of PHP but if you get weird errors, this might be something worth checking. (Note, this installation step is only necessary if you want members of your site to be able to send email to the site to start or respond to posts. If all posting will happen directly on the site, this step is unnecessary)
 
 * Go to the Modules page in Drupal and enable the module (like normal).  After saving, navigate to admin/og/og_mailinglist and configure per your server setup.
diff --git a/og_mailinglist_api.inc b/og_mailinglist_api.inc
index d2deb30..ca61c3a 100644
--- a/og_mailinglist_api.inc
+++ b/og_mailinglist_api.inc
@@ -188,7 +188,14 @@ function og_mailinglist_log_email_sent($source, $nid, $cid = 0, $message_id = 0,
  */
 function og_mailinglist_create_mailer() {
   og_mailinglist_phpmailer_load_library();
-  $mailer = new PHPMailer(TRUE); // The TRUE param means it will throw exceptions on errors, which we need to catch.
+  if (module_exists('phpmailer')) {
+    module_load_include('inc', 'phpmailer', 'includes/phpmailer.class');
+    module_load_include('inc', 'og_mailinglist', 'og_mailinglist_drupalphpmailer_class');
+  } else {
+    module_load_include('inc', 'og_mailinglist', 'og_mailinglist_phpmailer_class');
+  }
+  $mailer = new OGMailinglistPHPMailer(TRUE); // The TRUE param means it will throw exceptions on errors, which we need to catch.
+  $mailer->PluginDir = og_mailinglist_get_phpmailer_plugin_dir();
   $mailer->CharSet = 'UTF-8';
 
   return $mailer;
diff --git a/og_mailinglist_drupalphpmailer_class.inc b/og_mailinglist_drupalphpmailer_class.inc
new file mode 100644
index 0000000..25cb0c5
--- /dev/null
+++ b/og_mailinglist_drupalphpmailer_class.inc
@@ -0,0 +1,198 @@
+<?php
+// $Id: phpmailer.class.inc,v 1.17.2.5 2010/07/07 12:41:38 smk Exp $
+
+/**
+ * @file
+ * Implements the base PHPMailer for OGMailinglist class.
+ */
+
+/**
+ * Base PHPMailer for Drupal implementation with support for SMTP keep-alive
+ * and setting a custom Return-Path.
+ */
+class OGMailinglistPHPMailer extends DrupalPHPMailer {
+  /**
+   * Stores the addresses we want to deliver the message to.
+   */
+  private   $DeliverTo = array();
+
+  /**
+   * Stores the incoming message's date.
+   */
+  public $MessageDate = '';
+
+  /**
+   * Constructor.
+   */
+  public function __construct() {
+    // Throw exceptions instead of dying (since 5.0.0).
+    if (method_exists(get_parent_class($this), '__construct')) {
+      parent::__construct(TRUE);
+    }
+  }
+
+  public function __destruct() {
+    // Throw exceptions instead of dying (since 5.0.0).
+    if (method_exists(get_parent_class($this), '__destruct')) {
+      parent::__destruct(TRUE);
+    }
+  }
+
+  public function GetMessageDate() {
+    return $this->MessageDate;
+  }
+
+  public function AddDeliverTo($address) {
+    $this->DeliverTo[] = $address;
+  }
+
+  /**
+   * Sends mail using the $Sendmail program.
+   * @param string $header The message headers
+   * @param string $body The message body
+   * @access protected
+   * @return bool
+   */
+  public function SendmailSendDeliverTo($header, $body) {
+    if ($this->Sender != '') {
+      $sendmail = sprintf("%s -oi -f %s %s", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender),
+        escapeshellarg(implode(', ', $this->DeliverTo)));
+    } else {
+      $sendmail = sprintf("%s -oi %s", escapeshellcmd($this->Sendmail), escapeshellarg($this->DeliverTo));
+    }
+    if(!@$mail = popen($sendmail, 'w')) {
+      throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
+    }
+    fputs($mail, $header);
+    fputs($mail, $body);
+    $result = pclose($mail);
+    // implement call back function if it exists
+    $isSent = ($result == 0) ? 1 : 0;
+    $this->doCallback($isSent,$this->to,$this->cc,$this->bcc,$this->Subject,$body);
+    if($result != 0) {
+      throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
+    }
+    return true;
+  }
+
+  /**
+   * Sends mail via SMTP using PhpSMTP
+   * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
+   * @param string $header The message headers
+   * @param string $body The message body
+   * @uses SMTP
+   * @access protected
+   * @return bool
+   */
+  protected function SmtpSendDeliverTo($header, $body) {
+    require_once $this->PluginDir . 'class.smtp.php';
+    $bad_rcpt = array();
+
+    if ($this->SMTPDebug) {
+      ob_start();
+    }
+
+    try {
+      if(!$this->SmtpConnect()) {
+        throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL);
+      }
+      $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
+      if(!$this->smtp->Mail($smtp_from)) {
+        throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL);
+      }
+
+      // Attempt to send attach all recipients
+      foreach($this->DeliverTo as $to) {
+        if (!$this->smtp->Recipient($to)) {
+          $bad_rcpt[] = $to[0];
+          // implement call back function if it exists
+          $isSent = 0;
+          $this->doCallback($isSent,$to,'','',$this->Subject,$body);
+        } else {
+          // implement call back function if it exists
+          $isSent = 1;
+          $this->doCallback($isSent,$to,'','',$this->Subject,$body);
+        }
+      }
+
+      if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses
+        $badaddresses = implode(', ', $bad_rcpt);
+        throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses);
+      }
+      if(!$this->smtp->Data($header . $body)) {
+        throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL);
+      }
+    }
+    catch (phpmailerException $exception) {}
+
+    if ($this->SMTPDebug) {
+      if ($debug = ob_get_contents()) {
+        drupal_set_message($debug);
+      }
+      ob_end_clean();
+    }
+
+    // Reinitialize properties.
+    $this->Reset();
+
+    if (isset($exception)) {
+      // Pass exception to caller.
+      throw $exception;
+    }
+    return $result;
+  }
+
+  /**
+   * Creates message and assigns Mailer. If the message is
+   * not sent successfully then it returns false.  Use the ErrorInfo
+   * variable to view description of the error.
+   * @return bool
+   */
+  public function Send() {
+    if (count($this->DeliverTo) < 1) {
+      return parent::Send();
+    }
+
+    try {
+      // Set whether the message is multipart/alternative
+      if(!empty($this->AltBody)) {
+        $this->ContentType = 'multipart/alternative';
+      }
+
+      $this->error_count = 0; // reset errors
+      $this->SetMessageType();
+      $header = $this->CreateHeader();
+      $body = $this->CreateBody();
+
+      if (empty($this->Body)) {
+        throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL);
+      }
+
+      // digitally sign with DKIM if enabled
+      if ($this->DKIM_domain && $this->DKIM_private) {
+        $header_dkim = $this->DKIM_Add($header,$this->Subject,$body);
+        $header = str_replace("\r\n","\n",$header_dkim) . $header;
+      }
+
+      // Choose the mailer and send through it
+      switch($this->Mailer) {
+        case 'sendmail':
+          return $this->SendmailSendDeliverTo($header, $body);
+        case 'smtp':
+          return $this->SmtpSendDeliverTo($header, $body);
+        default:
+          return $this->MailSend($header, $body);
+      }
+
+    } catch (phpmailerException $e) {
+      $this->SetError($e->getMessage());
+      if ($this->exceptions) {
+        throw $e;
+      }
+      echo $e->getMessage()."\n";
+      return false;
+    }
+  }
+
+}
+
diff --git a/og_mailinglist_phpmailer_class.inc b/og_mailinglist_phpmailer_class.inc
new file mode 100644
index 0000000..9dd3cec
--- /dev/null
+++ b/og_mailinglist_phpmailer_class.inc
@@ -0,0 +1,172 @@
+<?php
+// $Id: phpmailer.class.inc,v 1.17.2.5 2010/07/07 12:41:38 smk Exp $
+
+/**
+ * @file
+ * Implements the base PHPMailer for OGMailinglist class.
+ */
+
+/**
+ * Base PHPMailer for Drupal implementation with support for SMTP keep-alive
+ * and setting a custom Return-Path.
+ */
+class OGMailinglistPHPMailer extends PHPMailer {
+  /**
+   * Stores the addresses we want to deliver the message to.
+   */
+  private   $DeliverTo = array();
+
+  /**
+   * Stores the incoming message's date.
+   */
+  public $MessageDate = '';
+
+  /**
+   * Constructor.
+   */
+  public function __construct() {
+    // Throw exceptions instead of dying (since 5.0.0).
+    if (method_exists(get_parent_class($this), '__construct')) {
+      parent::__construct(TRUE);
+    }
+  }
+
+  public function GetMessageDate() {
+    return $this->MessageDate;
+  }
+
+  public function AddDeliverTo($address) {
+    $this->DeliverTo[] = $address;
+  }
+
+  /**
+   * Sends mail using the $Sendmail program.
+   * @param string $header The message headers
+   * @param string $body The message body
+   * @access protected
+   * @return bool
+   */
+  public function SendmailSendDeliverTo($header, $body) {
+    if ($this->Sender != '') {
+      $sendmail = sprintf("%s -oi -f %s %s", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender),
+        escapeshellarg(implode(', ', $this->DeliverTo)));
+    } else {
+      $sendmail = sprintf("%s -oi %s", escapeshellcmd($this->Sendmail), escapeshellarg($this->DeliverTo));
+    }
+    if(!@$mail = popen($sendmail, 'w')) {
+      throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
+    }
+    fputs($mail, $header);
+    fputs($mail, $body);
+    $result = pclose($mail);
+    // implement call back function if it exists
+    $isSent = ($result == 0) ? 1 : 0;
+    $this->doCallback($isSent,$this->to,$this->cc,$this->bcc,$this->Subject,$body);
+    if($result != 0) {
+      throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
+    }
+    return true;
+  }
+
+  /**
+   * Sends mail via SMTP using PhpSMTP
+   * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
+   * @param string $header The message headers
+   * @param string $body The message body
+   * @uses SMTP
+   * @access protected
+   * @return bool
+   */
+  protected function SmtpSendDeliverTo($header, $body) {
+    require_once $this->PluginDir . 'class.smtp.php';
+    $bad_rcpt = array();
+
+    if(!$this->SmtpConnect()) {
+      throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL);
+    }
+    $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
+    if(!$this->smtp->Mail($smtp_from)) {
+      throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL);
+    }
+
+    // Attempt to send attach all recipients
+    foreach($this->DeliverTo as $to) {
+      if (!$this->smtp->Recipient($to)) {
+        $bad_rcpt[] = $to[0];
+        // implement call back function if it exists
+        $isSent = 0;
+        $this->doCallback($isSent,$to,'','',$this->Subject,$body);
+      } else {
+        // implement call back function if it exists
+        $isSent = 1;
+        $this->doCallback($isSent,$to,'','',$this->Subject,$body);
+      }
+    }
+
+    if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses
+      $badaddresses = implode(', ', $bad_rcpt);
+      throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses);
+    }
+    if(!$this->smtp->Data($header . $body)) {
+      throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL);
+    }
+    if($this->SMTPKeepAlive == true) {
+      $this->smtp->Reset();
+    }
+    return true;
+  }
+
+  /**
+   * Creates message and assigns Mailer. If the message is
+   * not sent successfully then it returns false.  Use the ErrorInfo
+   * variable to view description of the error.
+   * @return bool
+   */
+  public function Send() {
+    if (count($this->DeliverTo) < 1) {
+      return parent::Send();
+    }
+
+    try {
+      // Set whether the message is multipart/alternative
+      if(!empty($this->AltBody)) {
+        $this->ContentType = 'multipart/alternative';
+      }
+
+      $this->error_count = 0; // reset errors
+      $this->SetMessageType();
+      $header = $this->CreateHeader();
+      $body = $this->CreateBody();
+
+      if (empty($this->Body)) {
+        throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL);
+      }
+
+      // digitally sign with DKIM if enabled
+      if ($this->DKIM_domain && $this->DKIM_private) {
+        $header_dkim = $this->DKIM_Add($header,$this->Subject,$body);
+        $header = str_replace("\r\n","\n",$header_dkim) . $header;
+      }
+
+      // Choose the mailer and send through it
+      switch($this->Mailer) {
+        case 'sendmail':
+          return $this->SendmailSendDeliverTo($header, $body);
+        case 'smtp':
+          return $this->SmtpSendDeliverTo($header, $body);
+        default:
+          return $this->MailSend($header, $body);
+      }
+
+    } catch (phpmailerException $e) {
+      $this->SetError($e->getMessage());
+      if ($this->exceptions) {
+        throw $e;
+      }
+      echo $e->getMessage()."\n";
+      return false;
+    }
+  }
+
+}
+
diff --git a/og_mailinglist_transport.inc b/og_mailinglist_transport.inc
index 3470ded..595fdb2 100755
--- a/og_mailinglist_transport.inc
+++ b/og_mailinglist_transport.inc
@@ -351,10 +351,12 @@ function _og_mailinglist_email_node_email($email, $node) {
   $email = _og_mailinglist_rewrite_headers($email, $node, TRUE);
   $footer = _og_mailinglist_build_footer($node);
   $email = _og_mailinglist_add_footer($email, $footer);
+  $headers = $email['structure']->headers;
+  unset($email['structure']->headers);
   $email['new_email_text'] = _og_mailinglist_encode_email(array($email['structure']));
   
   // Send it off.
-  _og_mailinglist_send_raw_email($email['new_email_text']);
+  _og_mailinglist_send_raw_email($headers, $email['new_email_text'], $node);
 
   // If the sender's subscription type isn't email, give him a thread subscription.
   if (og_mailinglist_get_group_subscription_type($node->og_groups[0], $node->uid) != "email") {
@@ -367,10 +369,12 @@ function _og_mailinglist_email_comment_email($email, $node, $comment) {
   $email = _og_mailinglist_rewrite_headers($email, $node, FALSE, $comment);
   $footer = _og_mailinglist_build_footer($node);
   $email = _og_mailinglist_add_footer($email, $footer);
+  $headers = $email['structure']->headers;
+  unset($email['structure']->headers);
   $email['new_email_text'] = _og_mailinglist_encode_email(array($email['structure']));
   
   // Send it off.
-  _og_mailinglist_send_raw_email($email['new_email_text']);
+  _og_mailinglist_send_raw_email($headers, $email['new_email_text'], $node);
 }
 
 function _og_mailinglist_parse_email($email) {
@@ -704,9 +708,7 @@ function _og_mailinglist_rewrite_headers($email, $node, $new_node = FALSE, $comm
   
   $new_headers['from'] = $headers['from'];
   $new_headers['to'] = $group_node->ogm_email . "@" . variable_get('og_mailinglist_server_string', 'example.com');
-  $new_headers['bcc'] =
-    array_to_comma_delimited_string(
-      _og_mailinglist_get_subscribers($node, $new_node));
+  $new_headers['bcc'] = _og_mailinglist_get_subscribers($node, $new_node);
   $new_headers['content-type'] = $headers['content-type'];
   $new_headers['content-transfer-encoding'] =  $headers['content-transfer-encoding'];
   
@@ -816,10 +818,63 @@ function _og_mailinglist_add_footer($email, $footer) {
   return $email;
 }
 
-function _og_mailinglist_send_raw_email($raw_email) {
-  $rand_filename = rand(1000, 10000000000);
-  file_put_contents("/tmp/" . $rand_filename, $raw_email . "\n");
-  system("/usr/sbin/sendmail -t < /tmp/" . $rand_filename);
+function _og_mailinglist_send_raw_email($headers, $body, $node) {
+  $mailer = og_mailinglist_create_mailer();
+  $mailer->ClearAddresses();
+
+  foreach($headers as $key => $value) {
+    switch (strtolower($key)) {
+      case 'date':
+	$mailer->MessageDate = $value;
+        break;
+      case 'message-id':
+        $mailer->MessageID = $value;
+        break;
+      case 'subject':
+	$mailer->Subject = $value;
+        break;
+      case 'to':
+        if (preg_match("/(^<)*<(.*?)>/", $value, $matches)) { 
+          $mailer->AddAddress($matches[1], $matches[2]);
+        } else
+          $mailer->AddAddress($value);
+        break;
+      case 'cc':
+        if (preg_match("/(^<)*<(.*?)>/", $value, $matches)) { 
+          $mailer->AddCC($matches[1], $matches[2]);
+        } else
+          $mailer->AddCC($value);
+        break;
+      case 'bcc':
+        foreach($value as $recipient) {
+          $mailer->AddDeliverTo($recipient);
+        }
+        break;
+      case 'from':
+        if (preg_match("/([^<]*)<(.*?)>/", $value, $matches)) { 
+          $mailer->From = $matches[2];
+          $mailer->FromName = $matches[1];
+        } else
+          $mailer->From = $value;
+        break;
+      default:
+        $mailer->AddCustomHeader($key . ':' . $value);
+    }
+  }
+
+  $mailer->Body = $body;
+
+  $success = $mailer->Send();
+  
+  if ($success) {
+    $parent_message_id = _og_mailinglist_get_thread_parent_messageid($email['headers']['in-reply-to']);
+    og_mailinglist_log_email_sent('web', $node->nid, $comment->cid, $mailer->MessageID, $headers['in_reply_to'], $headers['References'], $parent_message_id);
+  }
+  else {
+    watchdog('og_mailinglist', "OG_Mailinglist couldn't send a new node email.", NULL,
+             WATCHDOG_ERROR);
+  }
+  
 }
 
 /*
diff --git a/og_mailinglist_utilities.inc b/og_mailinglist_utilities.inc
index ce73965..eab20ff 100644
--- a/og_mailinglist_utilities.inc
+++ b/og_mailinglist_utilities.inc
@@ -274,6 +274,21 @@ function og_mailinglist_phpmailer_load_library() {
   return class_exists('PHPMailer');
 }
 
+/**
+ * Gets the directory in which PHPMailer is stored (for plugins)
+ *
+ * @return
+ *  TRUE if the PHPMailer library is loaded, FALSE otherwise.
+ */
+function og_mailinglist_get_phpmailer_plugin_dir() {
+  // First, try using libraries module.
+  if (module_exists('libraries')) {
+    // Let's see if PHPMailer is really available from libraries.
+    return './'. libraries_get_path('phpmailer') . '/';
+  }
+  return './'. drupal_get_path('module', 'og_mailinglist') .'/phpmailer/';
+}
+
 function og_mailinglist_mimeDecode_load_library() {
   if (!class_exists('Mail_mimeDecode')) {
     // First we'll try grabbing the file from a few default pear install locations.
diff --git a/phpmailer.patch b/phpmailer.patch
new file mode 100644
index 0000000..c006c84
--- /dev/null
+++ b/phpmailer.patch
@@ -0,0 +1,56 @@
+diff -ruN /home/nigel/websites/PHPMailer_v5.1/class.phpmailer.php phpmailer/class.phpmailer.php
+--- /home/nigel/websites/PHPMailer_v5.1/class.phpmailer.php	2009-11-11 11:04:14.000000000 +1100
++++ phpmailer/class.phpmailer.php	2010-11-30 14:11:54.536232002 +1100
+@@ -306,13 +306,13 @@
+   // PROPERTIES, PRIVATE AND PROTECTED
+   /////////////////////////////////////////////////
+ 
+-  private   $smtp           = NULL;
++  protected   $smtp           = NULL;
+   private   $to             = array();
+   private   $cc             = array();
+   private   $bcc            = array();
+   private   $ReplyTo        = array();
+   private   $all_recipients = array();
+-  private   $attachment     = array();
++  protected   $attachment     = array();
+   private   $CustomHeader   = array();
+   private   $message_type   = '';
+   private   $boundary       = array();
+@@ -321,7 +321,7 @@
+   private   $sign_cert_file = "";
+   private   $sign_key_file  = "";
+   private   $sign_key_pass  = "";
+-  private   $exceptions     = false;
++  protected   $exceptions     = false;
+ 
+   /////////////////////////////////////////////////
+   // CONSTANTS
+@@ -1065,6 +1065,9 @@
+     }
+   }
+ 
++  public function GetMessageDate() {
++    return self::RFCDate();
++  }
+   /**
+    * Assembles message header.
+    * @access public
+@@ -1078,7 +1081,7 @@
+     $this->boundary[1] = 'b1_' . $uniq_id;
+     $this->boundary[2] = 'b2_' . $uniq_id;
+ 
+-    $result .= $this->HeaderLine('Date', self::RFCDate());
++    $result .= $this->HeaderLine('Date', $this->GetMessageDate());
+     if($this->Sender == '') {
+       $result .= $this->HeaderLine('Return-Path', trim($this->From));
+     } else {
+@@ -1293,7 +1296,7 @@
+    * @access private
+    * @return void
+    */
+-  private function SetMessageType() {
++  protected function SetMessageType() {
+     if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
+       $this->message_type = 'plain';
+     } else {
