ALLOW SENDER HEADER not working
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.
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
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.