--- /var/www/html/beta.gewiss.si/sites/all/modules/mimemail/mimemail.module.ORIGINAL	2008-05-21 08:30:57.000000000 +0200
+++ /var/www/html/beta.gewiss.si/sites/all/modules/mimemail/mimemail.module	2008-05-21 11:41:06.000000000 +0200
@@ -53,6 +53,14 @@
     '#maxlength'     => 128,
     '#description'   => t('A valid e-mail address for this website, used by the auto-mailer during registration, new password requests, notifications, etc.')
   );
+  $form['smtp_return_path'] = array(
+    '#type'          => 'textfield',
+    '#title'         => t('SMTP Return-Path address'),
+    '#default_value' => variable_get('smtp_return_path', ''),
+    '#size'          => 60,
+    '#maxlength'     => 128,
+    '#description'   => t('Some mailers require a SMTP message send command to contain a valid Return-Path envelope address, provided through -f option; in case you have problems sending messages without that value being specified, you can try to resolve the issue entering webmasters e-mail address here')
+  );
   $form['mimemail']['mimemail_alter'] = array(
     '#type'          => 'checkbox',
     '#title'         => t('Use mime mail for all messages'),
@@ -285,12 +293,23 @@
         $message['address'] = array($message['address']);
       }
       $status = TRUE;
+
+      $smtp_return_path = variable_get('smtp_return_path', '');
+
+      if ($smtp_return_path == '') {
+        $returnpath_string = NULL;
+      }
+      else {
+        $returnpath_string = '"-f '. $smtp_return_path .'"';
+      }
+
       foreach ($message['address'] as $a) {
         $status = mail(
           $a,
           $message['subject'],
           $message['body'],
-          mimemail_rfc_headers($message['headers'])
+          mimemail_rfc_headers($message['headers']),
+          $returnpath_string
         ) && $status;
 
       }
