diff --git a/smtp.mail.inc b/smtp.mail.inc
index 7f78380..78134a5 100644
--- a/smtp.mail.inc
+++ b/smtp.mail.inc
@@ -122,8 +122,18 @@ public function mailWithoutQueue(array $message) {
         $from_name = variable_get('site_name', '');
       }
     }
+    $smtp_from_var = variable_get('smpt_from', FALSE);
 
     //Hack to fix reply-to issue.
+    $properfrom = $smtp_from_var ? $smtp_from_var : variable_get('site_mail', '');
+    if (!empty($properfrom)) {
+      $headers['From'] = $properfrom;
+    }
+
+    if ($smtp_from_var) {
+      $from_name = t("!name via !site_name", array('!name' => $from_name, '!site_name' => variable_get('site_name', '')));
+    }
+
     if (!isset($headers['Reply-To']) || empty($headers['Reply-To'])) {
       if (strpos($from, '<')) {
         $reply = preg_replace('/>.*/', '', preg_replace('/.*</', '', $from));
@@ -133,27 +143,35 @@ public function mailWithoutQueue(array $message) {
       }
       $headers['Reply-To'] = $reply;
     }
-    $properfrom = variable_get('site_mail', '');
-    if (!empty($properfrom)) {
-      $headers['From'] = $properfrom;
-      $from = $properfrom;
+
+    // Use sender to prevent 'You are not allowed to send mail from domain
+    // $from'.
+    $sender = $smtp_from_var;
+
+    if (empty($sender)) {
+      // If the 'smtp_from' config option is blank, use 'site_email'.
+      $sender = variable_get('site_mail', '');
     }
 
     // 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_mail', '')) == '') {
-          drupal_set_message(t('There is no submitted from address.'), 'error');
-          if ($logging) {
-            watchdog('smtp', 'There is no submitted from address.', array(), WATCHDOG_ERROR);
-          }
-          return FALSE;
-        }
+    // If from e-mail address is blank, use smtp_from config option.
+    if (empty($from)) {
+      $from = $sender;
+    }
+    // If the 'from' address is still empty, fail.
+    if (empty($from)) {
+      drupal_set_message(t('There is no submitted from address.'), 'error');
+      if ($logging) {
+        watchdog('smtp', 'There is no submitted from address.', array(), WATCHDOG_ERROR);
       }
+      return FALSE;      
     }
+
+    if (empty($sender)) {
+      // Will work only for servers that do not check for phishing.
+      $sender = $from;
+    }
+
     $from_comp = $this->_get_components($from);
 
     if (!valid_email_address($from_comp['email'])) {
@@ -177,6 +195,7 @@ public function mailWithoutQueue(array $message) {
       $mailer->AddAddress($to_comp['email'], $to_comp['name']);
     }
 
+    $replytoAdded = false;
 
     // Parse the headers of the message and set the PHPMailer object's settings
     // accordingly.
@@ -307,6 +326,10 @@ public function mailWithoutQueue(array $message) {
           $mailer->AddCustomHeader($key . ': ' . $value);
       }
     }
+    // Add the reply to
+    if (!$replytoAdded && $smtp_from_var) {
+      $mailer->AddReplyTo($properfrom, $from_name);
+    }
 
     /**
      * TODO
