Hi there,

I'm writing a new Milter to be used on transport_maps with tcp map:

transport_maps = tcp:127.0.0.1:9998

Here is the thing.

When I send one message, everything goes smoothly, but when I send
more than one message, I get this error:

postfix/trivial-rewrite[214756]: warning: read TCP map reply from
127.0.0.1:9998: unexpected EOF (Connection reset by peer).

The weirdest thing:
- When I send message to ONE recipient, everything goes fine;
- When I send multiple messages (two or more) each to only one
recipient, I get this error. But it doesn't stops here. The error
appears at the first attempt to the first recipient whenever I have
multiple attempts.

I have added logs on almost every step of my milter and I see postfix
requesting it. What I don't get is why postfix works fine for 1
connection but warns for multiples.

My Milter returns like this:
200 smtp:[ip]:port \n

Postmap seems to return right data:
# postmap -q "[email protected]" tcp:127.0.0.1:9998
smtp:[1.2.3.4]:25

Bellow logs when sending multiple messages:
--
phpmailer debug:
08:16:01 [1/1/1/1] SMTP 1.2.3.4 - Destino: [email protected] ...2025-10-16
11:16:01 CLIENT -> SERVER: MAIL FROM:<[email protected]>
2025-10-16 11:16:01 SMTP INBOUND: "250 2.1.0 Ok"
2025-10-16 11:16:01 SERVER -> CLIENT: 250 2.1.0 Ok
2025-10-16 11:16:01 CLIENT -> SERVER: RCPT TO:<[email protected]>
2025-10-16 11:16:01 SMTP INBOUND: "250 2.1.5 Ok"
2025-10-16 11:16:01 SERVER -> CLIENT: 250 2.1.5 Ok
2025-10-16 11:16:01 CLIENT -> SERVER: DATA
2025-10-16 11:16:01 SMTP INBOUND: "354 End data with <CR><LF>.<CR><LF>"
2025-10-16 11:16:01 SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF>
2025-10-16 11:16:01 CLIENT -> SERVER: Date: Thu, 16 Oct 2025 08:16:01 -0300
2025-10-16 11:16:01 CLIENT -> SERVER: To: [email protected]
2025-10-16 11:16:01 CLIENT -> SERVER: From: My User <[email protected]>
2025-10-16 11:16:01 CLIENT -> SERVER: Subject:
=?UTF-8?Q?Servi=C3=A7os_temporariamente_suspensos:_x.x.x.x?=
2025-10-16 11:16:01 CLIENT -> SERVER: Message-ID:
<p17Y7ezVoZXL3r1spQbcJ6CFphm3qJij7lEaR55w@infra>
2025-10-16 11:16:01 CLIENT -> SERVER: X-Mailer: PHPMailer 6.6.0
(https://github.com/PHPMailer/PHPMailer)
2025-10-16 11:16:01 CLIENT -> SERVER: MIME-Version: 1.0
2025-10-16 11:16:01 CLIENT -> SERVER: Content-Type: text/html; charset=UTF-8
2025-10-16 11:16:01 CLIENT -> SERVER:
2025-10-16 11:16:01 CLIENT -> SERVER: [{recipient}] - Test on
16/10/2025 08:16:01
2025-10-16 11:16:01 CLIENT -> SERVER:
2025-10-16 11:16:01 CLIENT -> SERVER: .
2025-10-16 11:16:01 SMTP INBOUND: "250 2.0.0 Ok: queued as D565D665"
2025-10-16 11:16:01 SERVER -> CLIENT: 250 2.0.0 Ok: queued as D565D665
2025-10-16 11:16:01 CLIENT -> SERVER: QUIT
2025-10-16 11:16:01 SMTP INBOUND: "221 2.0.0 Bye"
2025-10-16 11:16:01 SERVER -> CLIENT: 221 2.0.0 Bye
2025-10-16 11:16:01 Connection: closed

Postfix Log:
Oct 16 11:26:34 my-smtp-server postfix/smtpd[215154]: connect from myip[1.2.3.4]
Oct 16 11:26:34 my-smtp-server postfix/trivial-rewrite[215156]:
warning: tcp:127.0.0.1:9998 lookup error for "*"
Oct 16 11:26:34 my-smtp-server postfix/trivial-rewrite[215156]:
warning: tcp:127.0.0.1:9998 lookup error for "*"
Oct 16 11:26:35 my-smtp-server postfix/trivial-rewrite[215156]:
warning: read TCP map reply from 127.0.0.1:9998: unexpected EOF
(Connection reset by peer)
Oct 16 11:26:36 my-smtp-server postfix/smtpd[215154]: 056485EE:
client=myip[1.2.3.4]
Oct 16 11:26:36 my-smtp-server postfix/cleanup[215157]: 056485EE:
message-id=<UKM66Hi43397bSXbG2tuYZsOXF2c65fAjQE8nuNM0E@infra>
Oct 16 11:26:36 my-smtp-server postfix/qmgr[214462]: 056485EE:
from=<[email protected]>, size=668, nrcpt=1 (queue active)
Oct 16 11:26:36 my-smtp-server postfix/trivial-rewrite[215156]:
warning: read TCP map reply from 127.0.0.1:9998: unexpected EOF
(Operation now in progress)
Oct 16 11:26:36 my-smtp-server postfix/smtpd[215154]: disconnect from
myip[1.2.3.4] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Oct 16 11:26:37 my-smtp-server postfix/smtp[215158]: 056485EE:
to=<[email protected]>, relay=1.2.3.4[1.2.3.4]:25], delay=2.5,
delays=1.1/1/0.03/0.33, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued
as 6E72F95A6B)
Oct 16 11:26:37 my-smtp-server postfix/qmgr[214462]: 056485EE: removed








PHPMailer debug:
08:16:01 [1/1/1/1] SMTP 1.2.3.4 - Destino: [email protected] ...2025-10-16
11:16:01 Connection: opening to 1.2.3.4:25
                                      , timeout=300, options=array (
                                        'ssl' =>
                                        array (
                                          'verify_peer' => false,
                                          'verify_peer_name' => false,
                                          'allow_self_signed' => true,
                                        ),
                                      )
2025-10-16 11:16:01 Connection: opened
2025-10-16 11:16:01 SMTP INBOUND: "220 my-smt-server.com ESMTP Postfix (Ubuntu)"
2025-10-16 11:16:01 SERVER -> CLIENT: 220 my-smt-server.com ESMTP
Postfix (Ubuntu)
2025-10-16 11:16:01 CLIENT -> SERVER: EHLO infra
2025-10-16 11:16:01 SMTP INBOUND: "250-my-smt-server.com"
2025-10-16 11:16:01 SMTP INBOUND: "250-PIPELINING"
2025-10-16 11:16:01 SMTP INBOUND: "250-SIZE 10240000"
2025-10-16 11:16:01 SMTP INBOUND: "250-VRFY"
2025-10-16 11:16:01 SMTP INBOUND: "250-ETRN"
2025-10-16 11:16:01 SMTP INBOUND: "250-STARTTLS"
2025-10-16 11:16:01 SMTP INBOUND: "250-ENHANCEDSTATUSCODES"
2025-10-16 11:16:01 SMTP INBOUND: "250-8BITMIME"
2025-10-16 11:16:01 SMTP INBOUND: "250-DSN"
2025-10-16 11:16:01 SMTP INBOUND: "250-SMTPUTF8"
2025-10-16 11:16:01 SMTP INBOUND: "250 CHUNKING"
2025-10-16 11:16:01 SERVER -> CLIENT: 250-my-smt-server.com
                                      250-PIPELINING
                                      250-SIZE 10240000
                                      250-VRFY
                                      250-ETRN
                                      250-STARTTLS
                                      250-ENHANCEDSTATUSCODES
                                      250-8BITMIME
                                      250-DSN
                                      250-SMTPUTF8
                                      250 CHUNKING
2025-10-16 11:16:01 CLIENT -> SERVER: MAIL FROM:<[email protected]>
2025-10-16 11:16:01 SMTP INBOUND: "250 2.1.0 Ok"
2025-10-16 11:16:01 SERVER -> CLIENT: 250 2.1.0 Ok
2025-10-16 11:16:01 CLIENT -> SERVER: RCPT TO:<[email protected]>
2025-10-16 11:16:01 SMTP INBOUND: "250 2.1.5 Ok"
2025-10-16 11:16:01 SERVER -> CLIENT: 250 2.1.5 Ok
2025-10-16 11:16:01 CLIENT -> SERVER: DATA
2025-10-16 11:16:01 SMTP INBOUND: "354 End data with <CR><LF>.<CR><LF>"
2025-10-16 11:16:01 SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF>
2025-10-16 11:16:01 CLIENT -> SERVER: Date: Thu, 16 Oct 2025 08:16:01 -0300
2025-10-16 11:16:01 CLIENT -> SERVER: To: [email protected]
2025-10-16 11:16:01 CLIENT -> SERVER: From: My User <[email protected]>
2025-10-16 11:16:01 CLIENT -> SERVER: Subject:
=?UTF-8?Q?Servi=C3=A7os_temporariamente_suspensos:_x.x.x.x?=
2025-10-16 11:16:01 CLIENT -> SERVER: Message-ID:
<UYILp8gZVqJObdSDD0cwjdpWieLJRdFtxjBwcCQhEE@infra>
2025-10-16 11:16:01 CLIENT -> SERVER: X-Mailer: PHPMailer 6.6.0
(https://github.com/PHPMailer/PHPMailer)
2025-10-16 11:16:01 CLIENT -> SERVER: MIME-Version: 1.0
2025-10-16 11:16:01 CLIENT -> SERVER: Content-Type: text/html; charset=UTF-8
2025-10-16 11:16:01 CLIENT -> SERVER:
2025-10-16 11:16:01 CLIENT -> SERVER: [{recipient}] - Test on
16/10/2025 08:16:01
2025-10-16 11:16:01 CLIENT -> SERVER:
2025-10-16 11:16:01 CLIENT -> SERVER: .
2025-10-16 11:16:02 SMTP INBOUND: "250 2.0.0 Ok: queued as E3067667"
2025-10-16 11:16:02 SERVER -> CLIENT: 250 2.0.0 Ok: queued as E3067667
2025-10-16 11:16:02 CLIENT -> SERVER: QUIT
2025-10-16 11:16:02 SMTP INBOUND: "221 2.0.0 Bye"
2025-10-16 11:16:02 SERVER -> CLIENT: 221 2.0.0 Bye
2025-10-16 11:16:02 Connection: closed

POSTFIX LOG:
Oct 16 11:26:34 my-smtp-server postfix/smtpd[215154]: connect from myip[1.2.3.4]
-->>> Oct 16 11:26:34 my-smtp-server postfix/trivial-rewrite[215156]:
warning: tcp:127.0.0.1:9998 lookup error for "*"
-->>> Oct 16 11:26:34 my-smtp-server postfix/trivial-rewrite[215156]:
warning: tcp:127.0.0.1:9998 lookup error for "*"

-->>> Oct 16 11:26:35 my-smtp-server postfix/trivial-rewrite[215156]:
warning: read TCP map reply from 127.0.0.1:9998: unexpected EOF
(Connection reset by peer)

Oct 16 11:26:36 my-smtp-server postfix/smtpd[215154]: 056485EE:
client=myip[1.2.3.4]
Oct 16 11:26:36 my-smtp-server postfix/cleanup[215157]: 056485EE:
message-id=<UKM66Hi43397bSXbG2tuYZsOXF2c65fAjQE8nuNM0E@infra>
Oct 16 11:26:36 my-smtp-server postfix/qmgr[214462]: 056485EE:
from=<[email protected]>, size=668, nrcpt=1 (queue active)
Oct 16 11:26:36 my-smtp-server postfix/trivial-rewrite[215156]:
warning: read TCP map reply from 127.0.0.1:9998: unexpected EOF
(Operation now in progress)
Oct 16 11:26:36 my-smtp-server postfix/smtpd[215154]: disconnect from
myip[1.2.3.4] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Oct 16 11:26:37 my-smtp-server postfix/smtp[215158]: 056485EE:
to=<[email protected]>, relay=1.2.3.4[1.2.3.4]:25], delay=2.5,
delays=1.1/1/0.03/0.33, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued
as 6E72F95A6B)
Oct 16 11:26:37 my-smtp-server postfix/qmgr[214462]: 056485EE: removed
--

Now when I send only one message to one recipient:
--
phpmailer logs:

CLIENT -> SERVER: MAIL FROM:<[email protected]>
2025-10-16 11:30:41 SMTP INBOUND: "250 2.1.0 Ok"
2025-10-16 11:30:41 SERVER -> CLIENT: 250 2.1.0 Ok
2025-10-16 11:30:41 CLIENT -> SERVER: RCPT TO:<[email protected]>
2025-10-16 11:30:41 SMTP INBOUND: "250 2.1.5 Ok"
2025-10-16 11:30:41 SERVER -> CLIENT: 250 2.1.5 Ok
2025-10-16 11:30:41 CLIENT -> SERVER: DATA
2025-10-16 11:30:41 SMTP INBOUND: "354 End data with <CR><LF>.<CR><LF>"
2025-10-16 11:30:41 SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF>
2025-10-16 11:30:41 CLIENT -> SERVER: Date: Thu, 16 Oct 2025 08:30:41 -0300
2025-10-16 11:30:41 CLIENT -> SERVER: To: [email protected]
2025-10-16 11:30:41 CLIENT -> SERVER: From: MyUser <[email protected]>
2025-10-16 11:30:41 CLIENT -> SERVER: Subject:
=?UTF-8?Q?Servi=C3=A7os_temporariamente_suspensos?=
2025-10-16 11:30:41 CLIENT -> SERVER: Message-ID:
<2ihB1EVzIl7hRHVd321Zcf3WrIDvPDwBOju74TPKaPo@infra>
2025-10-16 11:30:41 CLIENT -> SERVER: X-Mailer: PHPMailer 6.6.0
(https://github.com/PHPMailer/PHPMailer)
2025-10-16 11:30:41 CLIENT -> SERVER: MIME-Version: 1.0
2025-10-16 11:30:41 CLIENT -> SERVER: Content-Type: text/html; charset=UTF-8
2025-10-16 11:30:41 CLIENT -> SERVER:
2025-10-16 11:30:41 CLIENT -> SERVER: [{recipient}] - Teste em
16/10/2025 08:30:41
2025-10-16 11:30:41 CLIENT -> SERVER:
2025-10-16 11:30:41 CLIENT -> SERVER: .
2025-10-16 11:30:41 SMTP INBOUND: "250 2.0.0 Ok: queued as 1EBA45EE"
2025-10-16 11:30:41 SERVER -> CLIENT: 250 2.0.0 Ok: queued as 1EBA45EE
2025-10-16 11:30:41 CLIENT -> SERVER: QUIT
2025-10-16 11:30:41 SMTP INBOUND: "221 2.0.0 Bye"
2025-10-16 11:30:41 SERVER -> CLIENT: 221 2.0.0 Bye
2025-10-16 11:30:41 Connection: closed

POSTFIX LOGS:
Oct 16 11:30:41 my-smtp-server postfix/smtpd[215185]: connect from
myhost[1.2.3.4]
Oct 16 11:30:41 my-smtp-server postfix/smtpd[215185]: 1EBA45EE:
client=myhost[1.2.3.4]
Oct 16 11:30:41 my-smtp-server postfix/cleanup[215188]: 1EBA45EE:
message-id=<2ihB1EVzIl7hRHVd321Zcf3WrIDvPDwBOju74TPKaPo@infra>
Oct 16 11:30:41 my-smtp-server postfix/qmgr[214462]: 1EBA45EE:
from=<[email protected]>, size=669, nrcpt=1 (queue active)
Oct 16 11:30:41 my-smtp-server postfix/smtpd[215185]: disconnect from
myhost[1.2.3.4] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Oct 16 11:30:41 my-smtp-server postfix/smtp[215189]: 1EBA45EE:
to=<[email protected]>, relay=1.2.3.4[1.2.3.4]:25], delay=0.13,
delays=0.05/0/0.03/0.06, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued
as 3D9CB962F0)
Oct 16 11:30:41 my-smtp-server postfix/qmgr[214462]: 1EBA45EE: removed
--


Any tips?

Thanks in advance.

BR,

Rafael
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to