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:
[email protected] -> ( ([email protected] -> yuko@localhost) and
[email protected])
    Aliases:
    [email protected] : [email protected] (yuko3000)
    [email protected] : [email protected]

The correct example (which is failing) is:
[email protected] -> [email protected] -> ( yuko@localhost and
[email protected] )
    Aliases:
    [email protected] : [email protected] (yuko3000)
    [email protected] : [email protected]

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

On Mon, 26 Jun 2023 at 11:53, Viktor Dukhovni via Postfix-users <
[email protected]> wrote:

> On Mon, Jun 26, 2023 at 11:04:37AM +0900, Alberto Lepe via Postfix-users
> wrote:
>
> > I have a mailing list like:
> >
> > [email protected]:
> >         [email protected]
> >         [email protected]
> >         [email protected]
> >         [email protected]
>
> Post the output of:
>
>     $ postmap -q '[email protected]' $(postconf -xh virtual_alias_maps)
>

output:  [email protected],peter0000,sam0000,jennifer0000


> Ditto for:
>
>     $ postmap -q '[email protected]' $(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 '[email protected]' $(postconf -xh virtual_alias_maps)
Output:  yuko3000,[email protected]


> > in which, [email protected] is forwarded to:
> >         [email protected]
> >         [email protected]
> >
> > Sending an email to: "[email protected]" will reach the inbox in "
> > [email protected]", but not "[email protected]".
>
> Post all log entries pertaining to the processing of a message to
> "[email protected]".  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=<
[email protected]>, size=2640, nrcpt=4 (queue active)
Jun 25 13:55:20 email postfix/smtp[1780462]: 93DBF62D81: to=<
[email protected]>, orig_to=<[email protected]>,
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=<
[email protected]>, orig_to=<[email protected]>,
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=<
[email protected]>, orig_to=<[email protected]>,
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=<
[email protected]>, orig_to=<[email protected]>,
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=<
[email protected]>, 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=<
[email protected]>, 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=<
[email protected]>, 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=<
[email protected]>, 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: "[email protected]" will reach
> > both inboxes.
>
> Likewise post the relevant logs.
> >


Here are the logs when sending to "[email protected]" (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=<
[email protected]>
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=<
[email protected]>, size=1372, nrcpt=1 (queue active)
Jun 25 14:44:12 email postfix/smtp[1803635]: 68AAA62DE6: to=<
[email protected]>, orig_to=<[email protected]>,
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=<
[email protected]>, 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 `[email protected]`:

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=<
[email protected]>, size=2322, nrcpt=2 (queue active)
Jun 25 15:25:21 email postfix/smtp[1801896]: 6D00762DE1:
to=<*[email protected]
<[email protected]>*>, orig_to=<[email protected]>,
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=<*[email protected]
<[email protected]>*>, orig_to=<[email protected]>,
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=<
[email protected]>, 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 -- [email protected]
> To unsubscribe send an email to [email protected]
>
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to