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: sample@example.com' . "\r\n" .
'Reply-To: sample@example.com' . "\r\n" .
'Return-Path: sample@example.com'

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

mail($to, $subject, $message, $headers, "-f email@wherever.com");

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

raja
Published on 06-Apr-2020 08:45:45
Advertisements