Hi everyone, I am using Postfix as mail relay for an Office365 domain. On that Postfix I have set up a custom content_filter to manipulate email headers. Everything works normally, except one particular issue: if the Office365 sender sends an email to two recipients belonging to the same domain (e.g. gmail.com), only the first recipient receives the email; if the recipients belong to two different domains (e.g. yahoo.com and gmail.com), they both receive the email. My content_filter (that is a perl script) creates a temporary file for each processed email, and I have noticed that only one temp file is created if the recipients belong to the same domain, and two if they belong to different domains. Moreover, searching in the logs I found that Postfix creates a single queueID if the recipient belongs to the same domain, and two different queueIDs if they belong to different domains.
Here is the log with recipients belonging to two different domains, notice that two different queueIDs are created (A9CDF401EF and AE75F40268): Feb 5 11:38:13 AZN-POSTIFX postfix/smtpd[55654]: connect from mail-am6eur05lp2104.outbound.protection.outlook.com[104.47.18.104] Feb 5 11:38:13 AZN-POSTIFX postfix/smtpd[55654]: A9CDF401EF: client= mail-am6eur05lp2104.outbound.protection.outlook.com[104.47.18.104] Feb 5 11:38:13 AZN-POSTIFX postfix/cleanup[55657]: A9CDF401EF: message-id=< am0p195mb07403461ca43f2769ff0289689...@am0p195mb0740.eurp195.prod.outlook.com > Feb 5 11:38:13 AZN-POSTIFX postfix/qmgr[55479]: A9CDF401EF: from=< us...@senderdomain.com>, size=10621, nrcpt=1 (queue active) Feb 5 11:38:13 AZN-POSTIFX postfix/smtpd[55654]: AE75F40268: client= mail-am6eur05lp2104.outbound.protection.outlook.com[104.47.18.104] Feb 5 11:38:13 AZN-POSTIFX postfix/cleanup[55657]: AE75F40268: message-id=< am0p195mb07403461ca43f2769ff0289689...@am0p195mb0740.eurp195.prod.outlook.com > Feb 5 11:38:13 AZN-POSTIFX postfix/qmgr[55479]: AE75F40268: from=< us...@senderdomain.com>, size=10610, nrcpt=1 (queue active) Feb 5 11:38:13 AZN-POSTIFX postfix/smtpd[55654]: disconnect from mail-am6eur05lp2104.outbound.protection.outlook.com[104.47.18.104] Feb 5 11:38:13 AZN-POSTIFX postfix/pickup[55478]: BCF884026B: uid=1001 from=<us...@senderdomain.com> Feb 5 11:38:13 AZN-POSTIFX postfix/pipe[55658]: A9CDF401EF: to=< recipie...@gmail.com>, relay=filter_perl, delay=0.09, delays=0.02/0.01/0/0.06, dsn=2.0.0, status=sent (delivered via filter_perl service) Feb 5 11:38:13 AZN-POSTIFX postfix/qmgr[55479]: A9CDF401EF: removed Feb 5 11:38:13 AZN-POSTIFX postfix/cleanup[55657]: BCF884026B: message-id=< am0p195mb07403461ca43f2769ff0289689...@am0p195mb0740.eurp195.prod.outlook.com > Feb 5 11:38:13 AZN-POSTIFX postfix/pipe[55660]: AE75F40268: to=< recipie...@domain123.com>, relay=filter_perl, delay=0.07, delays=0.01/0.01/0/0.05, dsn=2.0.0, status=sent (delivered via filter_perl service) Feb 5 11:38:13 AZN-POSTIFX postfix/qmgr[55479]: AE75F40268: removed Feb 5 11:38:13 AZN-POSTIFX postfix/qmgr[55479]: BCF884026B: from=< us...@senderdomain.com>, size=10728, nrcpt=1 (queue active) Feb 5 11:38:13 AZN-POSTIFX postfix/pickup[55478]: C02F8401EF: uid=1001 from=<us...@senderdomain.com> Feb 5 11:38:13 AZN-POSTIFX postfix/cleanup[55657]: C02F8401EF: message-id=< am0p195mb07403461ca43f2769ff0289689...@am0p195mb0740.eurp195.prod.outlook.com > Feb 5 11:38:13 AZN-POSTIFX postfix/qmgr[55479]: C02F8401EF: from=< us...@senderdomain.com>, size=10739, nrcpt=1 (queue active) Feb 5 11:38:14 AZN-POSTIFX postfix/smtp[55671]: C02F8401EF: to=< recipie...@gmail.com>, relay=gmail-smtp-in.l.google.com[173.194.79.27]:25, delay=0.35, delays=0.04/0.01/0.16/0.15, dsn=2.0.0, status=sent (250 2.0.0 OK 1580899094 f23si13705950edq.421 - gsmtp) Feb 5 11:38:14 AZN-POSTIFX postfix/qmgr[55479]: C02F8401EF: removed Feb 5 11:38:14 AZN-POSTIFX postfix/smtp[55670]: BCF884026B: to=< recipie...@domain123.com>, relay=ip-129-6.sn-213-183.mailserver.com[123.123.129.6]:25, delay=0.66, delays=0.02/0.01/0.57/0.07, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 5D049181F3DF4) Feb 5 11:38:14 AZN-POSTIFX postfix/qmgr[55479]: BCF884026B: removed And here is the log with recipients both belonging to gmail.com , notice that only one queueID is created (641C6401EF) and only one email is relayed to gmail: Feb 5 11:35:48 AZN-POSTIFX postfix/smtpd[55568]: connect from mail-am5eur03lp2053.outbound.protection.outlook.com[104.47.8.53] Feb 5 11:35:48 AZN-POSTIFX postfix/smtpd[55568]: 641C6401EF: client= mail-am5eur03lp2053.outbound.protection.outlook.com[104.47.8.53] Feb 5 11:35:48 AZN-POSTIFX postfix/cleanup[55571]: 641C6401EF: message-id=< am0p195mb074014bc4ed377dba3bacdde89...@am0p195mb0740.eurp195.prod.outlook.com > Feb 5 11:35:48 AZN-POSTIFX postfix/qmgr[55479]: 641C6401EF: from=< us...@senderdomain.com>, size=10524, nrcpt=2 (queue active) Feb 5 11:35:48 AZN-POSTIFX postfix/smtpd[55568]: disconnect from mail-am5eur03lp2053.outbound.protection.outlook.com[104.47.8.53] Feb 5 11:35:48 AZN-POSTIFX postfix/pickup[55478]: 7738740269: uid=1001 from=<us...@senderdomain.com> Feb 5 11:35:48 AZN-POSTIFX postfix/pipe[55572]: 641C6401EF: to=< recipie...@gmail.com>, relay=fixcc, delay=0.09, delays=0.03/0.01/0/0.05, dsn=2.0.0, status=sent (delivered via fixcc service) Feb 5 11:35:48 AZN-POSTIFX postfix/pipe[55572]: 641C6401EF: to=< recipie...@gmail.com>, relay=fixcc, delay=0.09, delays=0.03/0.01/0/0.05, dsn=2.0.0, status=sent (delivered via fixcc service) Feb 5 11:35:48 AZN-POSTIFX postfix/qmgr[55479]: 641C6401EF: removed Feb 5 11:35:48 AZN-POSTIFX postfix/cleanup[55571]: 7738740269: message-id=< am0p195mb074014bc4ed377dba3bacdde89...@am0p195mb0740.eurp195.prod.outlook.com > Feb 5 11:35:48 AZN-POSTIFX postfix/qmgr[55479]: 7738740269: from=< us...@senderdomain.com>, size=10642, nrcpt=1 (queue active) Feb 5 11:35:48 AZN-POSTIFX postfix/smtp[55578]: 7738740269: to=< recipie...@gmail.com>, relay=gmail-smtp-in.l.google.com[173.194.79.26]:25, delay=0.39, delays=0.02/0.02/0.14/0.21, dsn=2.0.0, status=sent (250 2.0.0 OK 1580898948 cn3si15321822edb.537 - gsmtp) Feb 5 11:35:48 AZN-POSTIFX postfix/qmgr[55479]: 7738740269: removed Do you know why Postfix behaves this way?