Index: includes/mimemail.admin.inc
===================================================================
--- includes/mimemail.admin.inc (revision 953)
+++ includes/mimemail.admin.inc (working copy)
@@ -60,6 +60,12 @@
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
+ $form['mimemail']['incoming']['mimemail_envelope_sender'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Set the envelope sender address'),
+ '#default_value' => variable_get('mimemail_envelope_sender', 0),
+ '#description' => t('This option sets the envelope sender address with the -f sendmail option. This option will not be used if the site is running in safe_mode.'),
+ );
$form['mimemail']['incoming']['mimemail_incoming'] = array(
'#type' => 'checkbox',
'#title' => t('Process incoming messages posted to this site'),
Index: mimemail.module
===================================================================
--- mimemail.module (revision 978)
+++ mimemail.module (working copy)
@@ -222,14 +222,19 @@
$message['address'] = array($message['address']);
}
$status = TRUE;
+ if (variable_get('mimemail_envelope_sender', 0) && !ini_get('safe_mode') && isset($message['headers']['Return-Path'])) {
+ // If no explicit Return-path set, use From header and add Return-Path.
+ $return_path = preg_replace('/(.*<)?(.*?)>?/', "$2", $message['headers']['Return-Path']);
+ $additional_parameters = '-f'. $return_path;
+ }
foreach ($message['address'] as $a) {
$status = mail(
$a,
$message['subject'],
$message['body'],
- mimemail_rfc_headers($message['headers'])
+ mimemail_rfc_headers($message['headers']),
+ isset($additional_parameters)? $additional_parameters : NULL
) && $status;
-
}
return $status;
}