Index: smtp.module
===================================================================
--- smtp.module	(revision 1353)
+++ smtp.module	(working copy)
@@ -172,13 +172,13 @@
     '#type'          => 'textfield',
     '#title'         => t('E-mail from address'),
     '#default_value' => variable_get('smtp_from', ''),
-    '#description'   => t('The e-mail address that all e-mails will be from.'),
+    '#description'   => t('The e-mail address that all e-mails will be from. If left blank will use the admin email address of: %email', array('%email' => variable_get('site_mail', ''))),
   );
   $form['email_options']['smtp_fromname'] = array(
     '#type'          => 'textfield',
     '#title'         => t('E-mail from name'),
     '#default_value' => variable_get('smtp_fromname', ''),
-    '#description'   => t('The name that all e-mails will be from. If left blank will use the site name of: ') . variable_get('site_name', 'Drupal powered site'),
+    '#description'   => t('The name that all e-mails will be from. If left blank will use the site name of: %name', array('%name' => variable_get('site_name', 'Drupal powered site'))),
   );
 
   // If an address was given, send a test e-mail message.
@@ -296,11 +296,20 @@
     $from_name = variable_get('site_name', '');
   }
 
-  //Hack to fix reply-to issue.
-  $properfrom = variable_get('site_mail', '');
-  if (!empty($properfrom)) {
-    $headers['From'] = $properfrom;
+  if (variable_get('smtp_from', '') != '') {
+    $from = variable_get('smtp_from', '');
   }
+  else if (empty($from)) {
+    $from = variable_get('site_mail', '');
+  }
+
+  if (empty($from)) {
+    drupal_set_message(t('There is no submitted from address.'), 'error');
+    watchdog('smtp', 'There is no submitted from address.', array(), WATCHDOG_ERROR);
+    return FALSE;
+  }
+
+  //Hack to fix reply-to issue.
   if (!isset($headers['Reply-To']) || empty($headers['Reply-To'])) {
     if (strpos($from, '<')) {
       $reply = preg_replace('/>.*/', '', preg_replace('/.*</','',$from));
@@ -311,30 +320,6 @@
     $headers['Reply-To'] = $reply;
   }
 
-  // Blank value will let the e-mail address appear.
-
-  if ($from == NULL || $from == '') {
-    // If from e-mail address is blank, use smtp_from config option.
-    if ($from = variable_get('smtp_from', '') == '') {
-      // If smtp_from config option is blank, use site_email.
-      if ($from = variable_get('site_email', '') == '') {
-        drupal_set_message(t('There is no submitted from address.'), 'error');
-        watchdog('smtp', 'There is no submitted from address.', array(), WATCHDOG_ERROR);
-        return FALSE;
-      }
-    }
-  }
-/*
-  if ($from == NULL || $from == '') {
-    if (variable_get('smtp_from', '') != '') {
-      $from = variable_get('smtp_from', '');
-    }
-    else {
-      // If smtp_from config option is blank, use site_email.
-      $from = variable_get('site_email', '');
-    }
-  }
- */
   if (preg_match('/^"?.*"?\s*<.*>$/', $from)) {
     // . == Matches any single character except line break characters \r and \n.
     // * == Repeats the previous item zero or more times.
@@ -347,10 +332,18 @@
     return FALSE;
   }
 
-  // Defines the From value to what we expect.
-  $mail->From     = $from;
+  $headers['From'] 
+    = $headers['Return-Path'] 
+    = $headers['Errors-To'] 
+    = $from;
+
+  $headers['Sender']  = $from_name . ' <' . $from . '>';
+
+
+  // Defines the From and FromName values to what we expect.
+  $mail->From     = $headers['From'];
   $mail->FromName = $from_name;
-  $mail->Sender   = $from;
+//  $mail->Sender   = $headers['Sender'];
 
 
   // Create the list of 'To:' recipients.
