Mail Header [X-Envelope-To] Problem

dennis_81

Member
Sep 27, 2021
13
1
8
43
Hello,

we have problems with mail delivery at one of our customers. Therefore, we have created a rule that creates the X-Envelope-To in the header and inserts the __RECIEVER__ there.
This actually works quite well.
However, depending on who sends the mail, we have different behavior, which the customer's mail client unfortunately can't interpret properly. Here are two examples

When the orginal Header looks like this


Code:
To: <user1@domain.com>,

    <user2@domain.com>

the Server recieves two Mails both with the X-Envelope like this:

Code:
    X-Envelope-To: user1@domain.com, user2@domain.com

Unfortunately, the mail client cannot handle this and delivers the mail twice,

In another case the mail header looks like this

Code:
To: User 1 <user1@domain.com>, "user2@domain.com" <user2@domain.com>

In this case the mail server manages to generate two seperate mails and in each one there is only the X-Envelope-To from ONE address.

Code:
X-Envelope-To: user1@domain.com

Why is this happening?
Is it only in the line break?
Is there any way to prevent this? I want that ProxMox always has only ONE recipient address in the X-Envelope-To in each mail.


Thank you
Dennis
 
we have problems with mail delivery at one of our customers. Therefore, we have created a rule that creates the X-Envelope-To in the header and inserts the __RECIEVER__ there.
please share the complete rule

the __RECEIVERS__ macro will expand to a list of envelope addresses - they do not really need to be the same as the ones you see in the mail-header: https://en.wikipedia.org/wiki/Bounce_address

also share the logs from PMG for each type of mail.

I'm not sure that what you want to achieve will be easily possible
 
Hi Stoiko,

theres nothing more than this in the rule:

1645476346525.png

I just analyzed the logs again.
I noticed that the sending mail server makes the difference. In one case, the mail server already initiates two sessions and transfers two individual mails to ProxMox. In the second case, the sending mail server transfers only one mail with two recipients:

Code:
Feb 21 17:09:40 mail01 pmg-smtp-filter[1992536]: 141A4B6213B943A436D: accept mail to <user2@domain.com> (44C66141A4C) (rule: default-accept)
Feb 21 17:09:40 mail01 pmg-smtp-filter[1992536]: 141A4B6213B943A436D: accept mail to <user1@domain.com> (44C66141A4C) (rule: default-accept)
Feb 21 17:09:40 mail01 pmg-smtp-filter[1992536]: 141A4B6213B943A436D: processing time: 0.613 seconds (0.576, 0.02, 0)
Feb 21 17:09:40 mail01 postfix/lmtp[1992665]: 982FF141A47: to=<user2@domain.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.68, delays=0.06/0/0/0.62, dsn=2.5.0, status=sent (250 2.5.0 OK (141A4B6213B943A436D))
Feb 21 17:09:40 mail01 postfix/lmtp[1992665]: 982FF141A47: to=<user1@domain.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.68, delays=0.06/0/0/0.62, dsn=2.5.0, status=sent (250 2.5.0 OK (141A4B6213B943A436D))
Feb 21 17:09:40 mail01 postfix/qmgr[1989228]: 982FF141A47: removed
Feb 21 17:09:40 mail01 postfix/smtp[1992851]: Trusted TLS connection established to 1.2.110.107[1.2.110.107]:25: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Feb 21 17:09:40 mail01 postfix/smtp[1992851]: 44C66141A4C: to=<user2@domain.com>, relay=1.2.110.107[1.2.110.107]:25, delay=0.27, delays=0/0/0.01/0.26, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 48A01280241)
Feb 21 17:09:40 mail01 postfix/smtp[1992851]: 44C66141A4C: to=<user1@domain.com>, relay=1.2.110.107[1.2.110.107]:25, delay=0.27, delays=0/0/0.01/0.26, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 48A01280241)

Do you have any other ideas on how else I can make this work?
 
we have problems with mail delivery at one of our customers. Therefore, we have created a rule that creates the X-Envelope-To in the header and inserts the __RECIEVER__ there.
What are the problems you're having there - and why should adding another header help with those problems?

If I understand what you're trying to accomplish maybe I can suggest an alternative solution - but I don't see how adding a header containing the envelop receiver would help with issues in mail delivery
 
We forward mails from ProxMox to a Plesk catch-all mailbox and download it from there with a mail client (Tobit).
If an email with two or more recipients is now sent to Plesk, Plesk stores a separate mail in the system for each recipient. All these mails are completely identical. Unfortunately, the mail client does not manage to determine from the message ID that this mail is duplicate and then delivers these mails to each mailbox multiple times - once for each recipient.

For example:

Mail is send to user1@domain.com, user2@domain.com and user3@domain.com then User1 has three identical mails in his inbox...

Outlook or Exchange can handle this without any problems. Only this mail client unfortunately not. I see that the problem is there, nevertheless we have to solve it somehow.

We can set in the client which header is used. This also works great if we set the X-Original-To and there is only one recipient in there. But if there are more than one recipient, we have the same problem again.
 
If an email with two or more recipients is now sent to Plesk, Plesk stores a separate mail in the system for each recipient.
Is this any different with PMG in the middle than without?
if so - please show the logs of the plesk installation showing the different behavior (it would give me something to work with)
Unfortunately, the mail client does not manage to determine from the message ID that this mail is duplicate and then delivers these mails to each mailbox multiple times - once for each recipient.

This is something I would expect from a mail-client - multiple mails being sent result in multiple mails being delivered.

I know of the magic duplicate detection in outlook/exchange - but do consider this behavior to be wrong

The only knob that might modify the behavior of PMG regarding how mails to multiple recipients are treated is `smtpd_recipient_limit` - in order to force the sending server to open a new session for each rcpt to command - but that's inverse of what you're aiming for - and causes massively more load on the system (instead of analyzing the mail once it will me analyzed once/recipient)
 
The behavior is the same - with and without ProxMox.
But in ProxMox I can change the header. I hoped with this I could solve the problem.

Plesk support says:

...this behavior is expected: [...]

This means that every copy of the message that is sent to a non-existing mail address will be forwarded to the catch-all address. If the sender sends the message to n invalid addresses, the catch-all address will receive n copies of that same message.

To be honest, I don't understand the behavior of Plesk with a catch-all. I guess that's because it actively forwards the mails to the catch-all and changes the recipients in the header. (The recipient is then the catch-all mailbox and not the original recipient).
But we can't be the only ones who still use catch-all mailboxes and who have such problems...
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!