Setting $message_envelope different from $phpmailer_smtpuser prevents sending

We are trying to set up bounce handling, and when we set message_envelope that needs to be set to handle bounces, we get the following error:
Error sending email to xxx SMTP Error: The following recipients failed: xxx: : Sender address rejected: not owned by user yyy

$message_envelope is different from the sender email, $phpmailer_smtpuser because we do not want bounces to crowd the human read email that we are sending mail from.

Any idea how to work around this or is there a misconfiguration somewhere?

@Henri The email address that replies go to should be the From address when composing the campaign.

It is usually ok to set $message_envelope to be the same as the smtp user address. Your server seems to be complaining that the address is not owned by user yyy. I’m not sure what that means.
Are both $message_envelope and $phpmailer_smtpuser real email addresses on the same domain?

Thanks for the reply.

The From address and $phpmailer_smtpuser are the same email address in this case.

Both xxx and yyy in my example are real emails. I am a little bit confused now since the instructions in the config.php file say I should use a separate address for bounces that is not used by a human, but if I do so I am unable to send any mail.

I am getting the “Error sending email to xxx SMTP Error: The following recipients failed: xxx: : Sender address rejected: not owned by user yyy” error if $phpmailer_smtpuser and $message_envelope aren’t the same email. In this case, xxx and yyy are both real emails.

I’ve browsed through the forum and other people seem to be able to set phpmailer_smtpuser and message_envelope to be a different email.

Any ideas how to troubleshoot this further or should I just set them to be them same address?

@Henri You appear to be saying that using an address such as bounces@yourdomain.com for both message envelope and the smtp user works. If that is the case then use a different address for the From address.

You would need to ask your hosting company to explain the exact restrictions on these addresses.

1 Like

Yes, that would send mail successfully. I will experiment with this.

Thank you for your time!

1 Like

I also had the same problem sending to an SMTP server on another machine (if the SMTP server is on the same machine, the PHPlist defaults work perfectly). This is the message I got:

Error sending email to recipient@hisdomain.com SMTP Error: The following recipients failed: recipient@hisdomain.com: listbounces@mydomain.com: Sender address rejected: not owned by user mysender@mydomain.com

My wrong settings were:

define(‘TEST’,0);
define(‘PHPMAILERHOST’, ‘mail.mydomain.com’);
define(‘PHPMAILERPORT’,‘587’);
$phpmailer_smtpport = ‘587’;
$phpmailer_smtpuser = ‘mysender@mydomain.com’;
$phpmailer_smtppassword = ‘mysender_password’;
$phpmailer_smtpsecure = ‘tls’;
define(‘PHPMAILER_SECURE’,‘tls’);

Here’s what I did to fix it:
In my case, the problem was that
In XXX/phplist/lists/config/config.php, I changed these lines:

$phpmailer_smtpuser = ‘listbounces@mydomain.com’;
$phpmailer_smtppassword = ‘listbounces_password’;

It seems that the SMTP server (Mailcow) wanted the SMTP logged-in user has to be the same as the Return-path in the recipient’s email. On the recipient side, it looks as if the email was sent from mysender@mydomain.com, and that is also the Reply-to address. So it seems to be working perfectly.

Here’s how I found the error:
In XXX/phplist/lists/config/config.php, change / add this line:

define(‘PHPMAILER_SMTP_DEBUG’,5);

To ensure settings are activated, on the Linux command line, type this:

> sudo nginx -t && sudo systemctl reload nginx && echo "NGINX CONFIG OK."

In PHPlist on your browser, create a campaign, then
→ “Send a campaign”

At the bottom of that screen, use “Send test” to send an email.

If you have an error, it will show “Error sending mail” and/or FAILED. Now scroll all the way to the top. There should be a [too] detailed transcript of what went wrong. From that, try to figure out what went wrong.

I hope this helps someone.