I'm sorry,  I realized that I made a mistake while trying to translate the
real situation to a simple example in my original message:

Instead of:
a...@example.com -> ( (y...@example.com -> yuko@localhost) and
yuko.exam...@gmail.com)
    Aliases:
    a...@example.com : y...@example.com (yuko3000)
    a...@example.com : yuko.exam...@gmail.com

The correct example (which is failing) is:
a...@example.com -> y...@example.com -> ( yuko@localhost and
yuko.exam...@gmail.com )
    Aliases:
    a...@example.com : y...@example.com (yuko3000)
    y...@example.com : yuko.exam...@gmail.com

The first one (previous mistaken example) works fine, while the second one
(the corrected example) doesn't.
Works if you send directly to "y...@example.com", but it never forwards to
gmail if you send a message to "sa...@example.com" or "a...@example.com".

On Mon, 26 Jun 2023 at 11:53, Viktor Dukhovni via Postfix-users <
postfix-users@postfix.org> wrote:

> On Mon, Jun 26, 2023 at 11:04:37AM +0900, Alberto Lepe via Postfix-users
> wrote:
>
> > I have a mailing list like:
> >
> > sa...@example.com:
> >         pe...@example.com
> >         s...@example.com
> >         jenni...@example.com
> >         a...@example.com
>
> Post the output of:
>
>     $ postmap -q 'sa...@example.com' $(postconf -xh virtual_alias_maps)
>

output:  a...@example.com,peter0000,sam0000,jennifer0000


> Ditto for:
>
>     $ postmap -q 'a...@example.com' $(postconf -xh virtual_alias_maps)
>

output: yuko3000

As usernames are not emails, postfix seems to stop here and it doesn't
resolve the next forward:

postmap -q 'y...@example.com' $(postconf -xh virtual_alias_maps)
Output:  yuko3000,yuko.exam...@gmail.com


> > in which, a...@example.com is forwarded to:
> >         y...@example.com
> >         yuko.exam...@gmail.com
> >
> > Sending an email to: "sa...@example.com" will reach the inbox in "
> > y...@example.com", but not "yuko.exam...@gmail.com".
>
> Post all log entries pertaining to the processing of a message to
> "sa...@example.com".  Perhaps the "@gmail.com" delivery is rejected by
> gmail, or is delivered to the user's junk mail "folder".
>
>
There is no attempt to forward the email to gmail, so Gmail is not getting
anything. There is no warning, no error, here are the logs (not forwarding
to gmail):

Jun 25 13:55:20 email postfix/smtpd[1780619]: connect from
mail_amavis.1.ltxf180v9uo2ytmh2umzysqra.mail_net[10.0.4.19]
Jun 25 13:55:20 email postfix/smtpd[1780619]: 1E08662DDD:
client=mail_amavis.1.ltxf180v9uo2ytmh2umzysqra.mail_net[10.0.4.19],
orig_queue_id=93DBF62D81, orig_client=mail.example.com[x.x.x.x]
Jun 25 13:55:20 email postfix/smtpd[1780619]: disconnect from
mail_amavis.1.ltxf180v9uo2ytmh2umzysqra.mail_net[10.0.4.19] ehlo=1
xforward=1 mail=1 rcpt=4 data=1 quit=1 commands=9
Jun 25 13:55:20 email postfix/qmgr[1736207]: 1E08662DDD: from=<
sen...@example.com>, size=2640, nrcpt=4 (queue active)
Jun 25 13:55:20 email postfix/smtp[1780462]: 93DBF62D81: to=<
jennifer0...@email.example.com>, orig_to=<sa...@example.com>,
relay=amavis[10.0.4.19]:10024, delay=39, delays=1.1/0.01/0/38, dsn=2.0.0,
status=sent (250 2.0.0 from MTA(smtp:[postfix]:10025): 250 2.0.0 Ok: queued
as 1E08662DDD)
Jun 25 13:55:20 email postfix/smtp[1780462]: 93DBF62D81: to=<
peter0...@email.example.com>, orig_to=<sa...@example.com>,
relay=amavis[10.0.4.19]:10024, delay=39, delays=1.1/0.01/0/38, dsn=2.0.0,
status=sent (250 2.0.0 from MTA(smtp:[postfix]:10025): 250 2.0.0 Ok: queued
as 1E08662DDD)
Jun 25 13:55:20 email postfix/smtp[1780462]: 93DBF62D81: to=<
sam0...@email.example.com>, orig_to=<sa...@example.com>,
relay=amavis[10.0.4.19]:10024, delay=39, delays=1.1/0.01/0/38, dsn=2.0.0,
status=sent (250 2.0.0 from MTA(smtp:[postfix]:10025): 250 2.0.0 Ok: queued
as 1E08662DDD)
Jun 25 13:55:20 email postfix/smtp[1780462]: 93DBF62D81: to=<
yuko3...@email.example.com>, orig_to=<sa...@example.com>,
relay=amavis[10.0.4.19]:10024, delay=39, delays=1.1/0.01/0/38, dsn=2.0.0,
status=sent (250 2.0.0 from MTA(smtp:[postfix]:10025): 250 2.0.0 Ok: queued
as 1E08662DDD)
Jun 25 13:55:20 email postfix/qmgr[1736207]: 93DBF62D81: removed
Jun 25 13:55:20 email postfix/virtual[1780620]: 1E08662DDD: to=<
jennifer0...@email.example.com>, relay=virtual, delay=0.08,
delays=0.03/0.02/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
Jun 25 13:55:20 email postfix/virtual[1780620]: 1E08662DDD: to=<
peter0...@email.example.com>, relay=virtual, delay=0.09,
delays=0.03/0.02/0/0.04, dsn=2.0.0, status=sent (delivered to maildir)
Jun 25 13:55:20 email postfix/virtual[1780620]: 1E08662DDD: to=<
sam0...@email.example.com>, relay=virtual, delay=0.12,
delays=0.03/0.02/0/0.07, dsn=2.0.0, status=sent (delivered to maildir)
Jun 25 13:55:20 email postfix/virtual[1780620]: 1E08662DDD: to=<
yuko3...@email.example.com>, relay=virtual, delay=0.14,
delays=0.03/0.02/0/0.09, dsn=2.0.0, status=sent (delivered to maildir)
Jun 25 13:55:20 email postfix/qmgr[1736207]: 1E08662DDD: removed


> > However, sending an email directly to: "a...@example.com" will reach
> > both inboxes.
>
> Likewise post the relevant logs.
> >


Here are the logs when sending to "a...@example.com" (not forwarding to
gmail):

Jun 25 14:44:12 email postfix/smtpd[1804250]: connect from
mail_amavis.1.ltxf180v9uo2ytmh2umzysqra.mail_net[10.0.4.19]
Jun 25 14:44:12 email postfix/cleanup[1803631]: D5DB162DE2: message-id=<
75bf2428-e2bf-f289-a40a-3afdd7da0...@example.com>
Jun 25 14:44:12 email postfix/smtpd[1804250]: disconnect from
mail_amavis.1.ltxf180v9uo2ytmh2umzysqra.mail_net[10.0.4.19] ehlo=1
xforward=1 mail=1 rcpt=1 data=1 quit=1 commands=6
Jun 25 14:44:12 email postfix/qmgr[1736207]: D5DB162DE2: from=<
sen...@example.com>, size=1372, nrcpt=1 (queue active)
Jun 25 14:44:12 email postfix/smtp[1803635]: 68AAA62DE6: to=<
yuko3...@email.example.com>, orig_to=<a...@example.com>,
relay=amavis[10.0.4.19]:10024, delay=41, delays=0.07/0/0/41, dsn=2.0.0,
status=sent (250 2.0.0 from MTA(smtp:[postfix]:10025): 250 2.0.0 Ok: queued
as D5DB162DE2)
Jun 25 14:44:12 email postfix/qmgr[1736207]: 68AAA62DE6: removed
Jun 25 14:44:12 email postfix/virtual[1804251]: D5DB162DE2: to=<
yuko3...@email.example.com>, relay=virtual, delay=0.05,
delays=0.01/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
Jun 25 14:44:12 email postfix/qmgr[1736207]: D5DB162DE2: removed

Here are the logs when sending directly to `y...@example.com`:

Jun 25 15:25:21 email postfix/smtpd[1802035]: connect from
mail_amavis.1.ltxf180v9uo2ytmh2umzysqra.mail_net[10.0.4.19]
Jun 25 15:25:21 email postfix/smtpd[1802035]: 64CFD62DDE:
client=mail_amavis.1.ltxf180v9uo2ytmh2umzysqra.mail_net[10.0.4.19],
orig_queue_id=6D00762DE1, orig_client=mail.example.com[x.x.x.x]
Jun 25 15:25:21 email postfix/smtpd[1802035]: disconnect from
mail_amavis.1.ltxf180v9uo2ytmh2umzysqra.mail_net[10.0.4.19] ehlo=1
xforward=1 mail=1 rcpt=2 data=1 quit=1 commands=7
Jun 25 15:25:21 email postfix/qmgr[1736207]: 64CFD62DDE: from=<
sen...@example.com>, size=2322, nrcpt=2 (queue active)
Jun 25 15:25:21 email postfix/smtp[1801896]: 6D00762DE1:
to=<*yuko.exam...@gmail.com
<yuko.exam...@gmail.com>*>, orig_to=<y...@example.com>,
relay=amavis[10.0.4.19]:10024, delay=35, delays=3.9/0.01/0/31, dsn=2.0.0,
*status=sent* (250 2.0.0 from MTA(smtp:[postfix]:10025): 250 2.0.0 Ok:
queued as 64CFD62DDE)
Jun 25 15:25:21 email postfix/smtp[1801896]: 6D00762DE1:
to=<*yuko3...@email.example.com
<yuko3...@email.example.com>*>, orig_to=<y...@example.com>,
relay=amavis[10.0.4.19]:10024, delay=35, delays=3.9/0.01/0/31, dsn=2.0.0,
*status=sent* (250 2.0.0 from MTA(smtp:[postfix]:10025): 250 2.0.0 Ok:
queued as 64CFD62DDE)
Jun 25 15:25:21 email postfix/qmgr[1736207]: 6D00762DE1: removed
Jun 25 15:25:21 email postfix/virtual[1802037]: 64CFD62DDE: to=<
yuko3...@email.example.com>, relay=virtual, delay=0.06,
delays=0.01/0.02/0/0.02, dsn=2.0.0, *status=sent* (delivered to maildir)

As you can see, the email is successfully forwarded to gmail.


>
> > I have read about similar issues when using virtual mailboxes. I'm using
> > MySQL:
>
> Virtual mailboxes have nothing to do with this.  Your issue is apparent
> non-delivery to a remote address.  Note that such non-delivery is common
> when DMARC policy or SPF records come into play, and the sender's domain
> specifies a limited set of legitimate sources that don't include your
> "example.com" MTAs.
>
> > virtual_alias_maps = mysql:/etc/postfix/mysql.aliases.cf
>
> This is the only relevant table.
>
> > How can I fix it? If more information is needed, please let me know.
>
> Naïve forwarding to remote domains works poorly these days.  It is best
> avoided, or else you'll need to jump through various rewriting hoops
> that simple envelope recipient expansion cannot handle.
>
>
Thank you, I agree. However we used to run that customer's mail server in a
monolithic setup using real linux accounts (not in MySQL) and worked
without issues (same mailing lists, same forwarding rules).
After migrating the mail server into a distributed system (using docker
swarm) with virtual mailboxes we had an issue in which the emails were
duplicated for accounts with forward settings (like 'yuko' in this
example).
Then, I found that there were many reports related to MySQL and duplicated
emails (not exactly this forward issue, sorry).
That duplication was fixed after changing some settings. I'm not sure if
this "forward issue" was present when the duplication of emails was
happening, but I assumed it might be related to that.


> --
>     Viktor.
> _______________________________________________
> Postfix-users mailing list -- postfix-users@postfix.org
> To unsubscribe send an email to postfix-users-le...@postfix.org
>
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to