# -- hashar 20120218
$headers['From'] = $from->toString();
- $headers['Return-Path'] = $from->address;
+ $returnPath = $from->address;
+ $extraParams = $wgAdditionalMailParams;
+
+ // Hook to generate custom VERP address for 'Return-Path'
+ wfRunHooks( 'UserMailerChangeReturnPath', array( $to, &$returnPath ) );
+ # Add the envelope sender address using the -f command line option when PHP mail() is used.
+ # Will default to the $from->address when the UserMailerChangeReturnPath hook fails and the
+ # generated VERP address when the hook runs effectively.
+ $extraParams .= ' -f ' . $returnPath;
+
+ $headers['Return-Path'] = $returnPath;
if ( $replyto ) {
$headers['Reply-To'] = $replyto->toString();
self::quotedPrintable( $subject ),
$body,
$headers,
- $wgAdditionalMailParams
+ $extraParams
);
}
}