Index: smtp.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smtp/smtp.module,v
retrieving revision 1.15
diff -u -r1.15 smtp.module
--- smtp.module	28 May 2007 20:02:41 -0000	1.15
+++ smtp.module	27 Nov 2007 05:16:30 -0000
@@ -179,7 +179,7 @@
         $from = $value; //If a from value was already given then set based on header.
       }
     }
-    else if (strtolower($key) == 'content-type' and strtolower($value) == 'text/html') {
+    else if (strtolower($key) == 'content-type' and strpos(strtolower($value),'text/html') !== FALSE ) {
       $mail->IsHTML(TRUE);
     }
     else { //Else the header key is not special, just add it.
@@ -911,11 +911,24 @@
      */
     function AddrFormat($addr) {
         if(empty($addr[1]))
+        {
             $formatted = $addr[0];
+        }    
         else
         {
-            $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . 
-                         $addr[0] . ">";
+            // If the from address already contains a name and address, as indicated
+            // by the angle brackets, then ignore the FromName and simply use
+            // the From field as it was provided.  This allows per-call override
+            // of the From field when using the smtp module, important to modules
+            // such as OG
+            if(strpos($addr[0], "<") !== false && strpos($addr[0], ">") !== false) 
+            {
+                $formatted = $addr[0];
+            } 
+            else 
+            {
+                $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . $addr[0] . ">";
+            }   
         }
 
         return $formatted;
