Return-path in mail() not changing through script


I have a problem in the emails sent through php mail() and mb_send_mail(). The problem is related to the Return-path. I have tried to set it to something other than the default through the script but it is not changing, the messages are being delivered with the default settings.

Tried all the following

@ini_set("sendmail_from", $from);

$header .= 'Return-Path: <'.$from.">\

Header has FROM, Reply-To, X-Mailer, CC

$additional_parameter = '-f'.$from;

None of these worked… am I missing something?

Not sure what you’re getting at… ?

Tried this, and didn’t work

$additional_parameter = '-f'.$from.' -r'.$from;

Some environments like cPanel will strip out the ‘Return-Path:’ This work-around worked for me: