Change the Return-Path in PHP mail function


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

$headers = 'From: sample@example.com' . "\r
" . 'Reply-To: sample@example.com' . "\r
" . '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.

Updated on: 06-Apr-2020

369 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements