postal icon indicating copy to clipboard operation
postal copied to clipboard

ALLOW SENDER HEADER not working

Open pradeepnarayan888 opened this issue 5 years ago • 2 comments

Hi, I am trying to use the feature ALLOW SENDER HEADER - If enabled, outgoing messages can use any address in the From header as long as a Sender header is included with an authorized address.

I am using a PHPmailer script to send mail.

Below code works $mail = new PHPMailer(true); $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'postal.campaignposts.info'; // Specify main and backup server $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '*****'; // SMTP username $mail->Password = '**********'; // SMTP password $mail->Port = 25; $mail->setFrom('[email protected]', 'John');

But if i want to send as a different user using below code, it gives error 'SMTP Error - 530 From/Sender name is not valid.'

$mail = new PHPMailer(true); $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'postal.campaignposts.info'; // Specify main and backup server $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '*****'; // SMTP username $mail->Password = '**********'; // SMTP password $mail->Port = 25; $mail->Sender = '[email protected]'; $mail->setFrom('[email protected]', 'John');

Can someone help me solve this.

pradeepnarayan888 avatar Jul 07 '21 03:07 pradeepnarayan888

Add the sender domain in postal domain add,

no matter records verified or not this error will not come out , your email will send

But for better delivery dkim , spf records should be pass

rccess avatar Jul 07 '21 04:07 rccess

Have a look at https://github.com/PHPMailer/PHPMailer/issues/1250

It seems you may need to use $mail->addCustomHeader to set the sender header as well as using the direct method you are currently.

willpower232 avatar Jul 07 '21 10:07 willpower232