Score:0

postfix commands=5 causing mails not being sent

in flag

I'm able to send only mails using postfix but when it comes to sending mails to my own domain, postfix usually uses commands=6 which sends the email but sometimes it issues the commands=5 which causes the mails to fail and i don't know where they end up.

The line in the below dump which causes the error -

disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
20FB641206: from=<[email protected]>, size=3149, nrcpt=1 (queue active)

The dump from postfix

Aug 10 07:29:49 ubuntu postfix/smtpd[1669634]: connect from localhost[127.0.0.1]
Aug 10 07:29:49 ubuntu postfix/smtpd[1669634]: 20FB641206: client=localhost[127.0.0.1]
Aug 10 07:29:49 ubuntu postfix/cleanup[1669637]: 20FB641206: message-id=<632614904.2235.1691652589133@ubuntu>
Aug 10 07:29:49 ubuntu postfix/smtpd[1669634]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Aug 10 07:29:49 ubuntu postfix/qmgr[533470]: 20FB641206: from=<[email protected]>, size=3149, nrcpt=1 (queue active)
Aug 10 07:29:49 ubuntu postfix/smtp[1669638]: 20FB641206: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[142.251.167.27]:25, delay=0.54, d
elays=0/0/0.23/0.31, dsn=2.0.0, status=sent (250 2.0.0 OK  1691652589 d7-20020a0cb2c7000000b0063d456fcd44si447714qvf.515 - gsmtp)
Aug 10 07:29:49 ubuntu postfix/qmgr[533470]: 20FB641206: removed

Postfix mostly uses the commands=6 which causes the mails being sent -

Aug 10 07:29:44 ubuntu postfix/smtpd[1669634]: connect from localhost[127.0.0.1]
Aug 10 07:29:44 ubuntu postfix/smtpd[1669634]: 1B16341206: client=localhost[127.0.0.1]
Aug 10 07:29:44 ubuntu postfix/cleanup[1669637]: 1B16341206: message-id=<835472293.2234.1691652584108@ubuntu>
Aug 10 07:29:44 ubuntu postfix/smtpd[1669634]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=2 data=1 quit=1 commands=6
Aug 10 07:29:44 ubuntu postfix/qmgr[533470]: 1B16341206: from=<[email protected]>, size=1043, nrcpt=2 (queue active)
Aug 10 07:29:44 ubuntu postfix/smtp[1669638]: 1B16341206: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[142.251.167.27]:25, delay=0.6, del
ays=0.01/0/0.23/0.36, dsn=2.0.0, status=sent (250 2.0.0 OK  1691652584 o5-20020a05620a0d4500b00767507d715asi489272qkl.541 - gsmtp)
Aug 10 07:29:46 ubuntu postfix/smtp[1669639]: 1B16341206: to=<[email protected]>, relay=route1.mx.cloudflare.net[2606:4700:f5::c]:25, delay=2.6, delays=0.01
/0/0.19/2.4, dsn=2.0.0, status=sent (250 2.0.0 Ok)
Aug 10 07:29:46 ubuntu postfix/qmgr[533470]: 1B16341206: removed

the /etc/postfix/main.cf file -

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2



# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level=may

smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache


smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = ubuntu
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, smtp.domain.com, ubuntu, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all
jp flag
In both examples, the mail was successfully sent, as the log entry`status=sent` indicates.
Pradyut Bhattacharya avatar
in flag
@AlexD in the first case it's not sent to [email protected] - 20FB641206: from=<[email protected]>, size=3149, nrcpt=1 (queue active)
anx avatar
fr flag
anx
All 3 recipients where accepted (3 times `250 2.0.0 OK`) so maybe you were planning to have mail for your domain handled somewhere other than at `cloudflare.net`, but did not configure the MX records to say so?
Pradyut Bhattacharya avatar
in flag
my bad it's working fine see answer
Score:2
za flag

commands=N is not an error message, direct indication of success or failure; it's just for your information that during SMTP exchange there was N commands issued by the client, for you to roughly understand how long the conversation took.

Typical SMTP conversation looks like the following:

(connection established)
(server) 220 server.host.nam.me ESMTP blah-blah blah ...
(client) HELO [or EHLO] client.host.na.me
(server) 250-...
         250-...
         250 (proceed)
(client) MAIL FROM: [envelope sender email address]
(server) 250 (proceed)
(client) RCPT TO: [envelope recipient email address]
(server) 250 (proceed)
(client) DATA
(server) 250 (proceed end message with CRLF | "." | CRLF)
(client) message headers and data
(client) .
(server) 250 QUEUED as [some name]
(client) QUIT
(server) 221 Goodbye!
(connection terminated)

If you count how many times client did something, you'd find it's 5: HELO, MAIL FROM, RCPT TO, DATA and QUIT. Those are commands, and as you see, typically it takes 5 commands to send a mail. In some cases it might be more: client may authenticate, or have several RCPT TO commands (to add more recipients for this message), or whatever. I believe this is your case: additional recipient admin@... causes extra RCPT TO command to be issued.

Also in some cases server or client may interrupt the conversation early. For example, if server doesn't want to relay mail with certain envelope sender address, it may indicate error instead of 250 (accepted) reply code after receiving MAIL FROM, and client may reply with QUIT to that, resulting in a conversation taking less than 5 commands. So if you see a number less that 5 there, it may be the indication of a failure (but not always).

The only definitive indication of the delivery status of a message is the word after the status= in the log line:

Aug 10 07:29:46 ubuntu postfix/smtp[1669639]: 1B16341206: to=<[email protected]>, relay=route1.mx.cloudflare.net[2606:4700:f5::c]:25, delay=2.6, delays=0.01/0/0.19/2.4, dsn=2.0.0, status=sent (250 2.0.0 Ok)

This mail was sent, which really means, the route1.mx.cloudflare.net server replied with 250 (ok) ... after the last dot in the DATA command during the SMTP conversation. There may be other status here, which mean their corresponding statuses, and it is how Postfix indicates problems with the delivery.

Score:-1
in flag

My bad i was only sending in some emails in which case it showed commands=5

In case the email was sent and copied to [email protected] it showed commands=6

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.