Prabhu Murthi
Prabhu Murthi

Reputation: 2876

How to change the "Return-Path" header on email notification

Can any one please advice how do i change the mailing header Return-Path

from <[email protected]> to [email protected], since the notification emails are get into SPAM/JUNK folder.

Note: I have been advised to change this info on the mail sending code(PHP)

Upvotes: 2

Views: 6927

Answers (3)

Andres
Andres

Reputation: 2023

This is what i do and works every time

mail($to,$subject,$body,'From: [email protected]','-f [email protected]');

Upvotes: 5

John Conde
John Conde

Reputation: 219804

In the headers parameters of the mail() function you can set this:

<?php
$to      = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
    'Return-Path: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>    

Upvotes: 2

Naftali
Naftali

Reputation: 146302

Note: I have been advised to change this info on the mail sending code(PHP)

You should follow that advice :-D

Just add a From: [email protected] \r\n to the header of the mail that will be sent.

Upvotes: -1

Related Questions