- Server operating system version
- Debian GNU/Linux 11 (bullseye)
- Plesk version and microupdate number
- 18.0.77
Hello,
I've got this simple test code using phpMailer on my Plesk server :
And in mail log I've got the following error :
Apr 15 15:52:49 plesk msmtp: host=smtp.server.com tls=on auth=on user=smtp.user from=[email protected] recipients=[email protected] smtpstatus=501 smtpmsg='501 5.1.7 The specified sender domain has not been linked.' errormsg='envelope from address [email protected] not accepted by the server' exitcode=EX_DATAERR
As you can see, the "from" isn't the one I've written in the phpMailer code, it seems to be rewrite by Plesk.
How can I fix this, please ?
I've got this simple test code using phpMailer on my Plesk server :
PHP:
//Create a new PHPMailer instance
$mail = new PHPMailer\PHPMailer\PHPMailer();
//Set who the message is to be sent from
$mail->setFrom('[email protected]', 'Contact D1');
//Set an alternative reply-to address
$mail->addReplyTo('[email protected]', 'Contact D1');
//Set who the message is to be sent to
$mail->addAddress('[email protected]', 'Contact D2');
//Set the subject line
$mail->Subject = 'PHPMailer mail() test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML('<p>hello</p>');
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
// $mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent!';
}
And in mail log I've got the following error :
Apr 15 15:52:49 plesk msmtp: host=smtp.server.com tls=on auth=on user=smtp.user from=[email protected] recipients=[email protected] smtpstatus=501 smtpmsg='501 5.1.7 The specified sender domain has not been linked.' errormsg='envelope from address [email protected] not accepted by the server' exitcode=EX_DATAERR
As you can see, the "from" isn't the one I've written in the phpMailer code, it seems to be rewrite by Plesk.
How can I fix this, please ?