Change the Return-Path in PHP mail function

PHPServer Side ProgrammingProgramming

The reply and return path can be placed in the headers as shown below −

$headers = 'From:' . "\r\n" .
'Reply-To:' . "\r\n" .

Otherwise, it can be passed as the fifth parameter to change the return path −

mail($to, $subject, $message, $headers, "-f");

Here, '' has to be replaced with the user's respective email id.

Updated on 06-Apr-2020 08:46:09