Unable to receive email. Postfix not delivering email to local mailbox

SYSTEM INFORMATION :
OS type and version: Ubuntu Linux 22.04.4
Virtualmin version: 7.9.0
Postfix version: 3.6.4

I have a running configuration, and everything is working well. However, I haven’t received emails for some days, and this is the case for all mailboxes on this server.

I do the following tests:
Send an email from another mail server
Send an email from one email address to another on the same server.
In any case, I don’t have a return email saying an error. It looks like the email was delivered, but I don’t see it in my mailbox.
Stop ClamAV and SpamAssassin and retry to send an email from another email server.

After investigation, I found the messages I tested on Postfix’s mail queue.
What is strange is that the mailbox name has been added @com. For example, bob-domain.com@com, Instead of bob-domain.com. And I have the following error: delivery temporarily suspended: Host or domain name not found. Name service error for name=com type=AAAA: Host not found, try again

On the mail.log, I have the following error message:
to=bob-domain.com@com, orig_to=bob@domain.com, relay=none, delay=353290, delays=353289/0.16/0/0, dsn=4.4.3, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=com type=AAAA: Host not found, try again)

It looks like something add the “@com” at the end of all mail to deliver locally.

I don’t remember touching any Postfix configuration. I think I just performed regular maintenance tasks like module and OS updates.

result of postconf -n:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_percent_hack = no
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
compatibility_level = 2
home_mailbox = Maildir/
inet_protocols = all
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
milter_default_action = accept
mydestination = $myhostname, HOSTNAME, xxx.contaboserver.net, localhost.contaboserver.net, localhost
myhostname = xxxxxxx.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mynetworks_style = subnet
myorigin = $mydomain
non_smtpd_milters = inet:localhost:8891
readme_directory = no
recipient_delimiter = +
sender_bcc_maps = hash:/etc/postfix/bcc
sender_dependent_default_transport_maps = hash:/etc/postfix/dependent
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_milters = inet:localhost:8891
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
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
tls_server_sni_maps = hash:/etc/postfix/sni_map
virtual_alias_maps = hash:/etc/postfix/virtual

Anybody who can help ?

I’ve never seen anyone report anything like this.

Look at /etc/postfix/virtual as that’s probably where the address rewriting is happening (though there are many other maps that could do it).

What’s the actual hostname of the system? Why have you overridden it in the Postfix main.cf? That’s often a source of confusion. You should usually make your system hostname the name you want it to be (but not something you’re virtually hosting in the virtual map) and not override any of myhostname, myorigin, and mydestination. Those cause people a lot of confusion. Leaving them at their defaults and getting the result you want by just naming the system something reasonable is very likely a better choice.

I’m guessing there’s something weird about your hostname, basically, and you’ve manually set some stuff in main.cf to try to fix that, but it’s making it fail in even more confusing ways.

This is mine, so you can see what joe means.

root@server:~# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_percent_hack = no
bounce_notice_recipient = admin@mydomain.com
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
compatibility_level = 2
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
error_notice_recipient = admin@mydomain.com
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 20480000
meta_directory = /etc/postfix
milter_default_action = accept
mydestination = $myhostname,localhost.$mydomain, localhost
newaliases_path = /usr/bin/newaliases.postfix
non_smtpd_milters = inet:localhost:8891
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix/README_FILES
resolve_dequoted_address = no
sample_directory = /usr/share/doc/postfix/samples
sender_bcc_maps = hash:/etc/postfix/bcc
sender_dependent_default_transport_maps = hash:/etc/postfix/dependent
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
shlib_directory = /usr/lib64/postfix
smtp_dns_support_level = dnssec
smtp_host_lookup = dns
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
smtp_tls_CApath = /etc/pki/tls/certs
smtp_tls_security_level = dane
smtpd_milters = inet:localhost:8891
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination check_policy_service unix:/var/spool/postfix/postgrey/socket
smtpd_relay_restrictions = ${{$compatibility_level} < {1} ? {} : {permit_mynetworks permit_sasl_authenticated defer_unauth_destination}}
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_tls_CAfile = /etc/postfix/postfix.ca.pem
smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem
smtpd_tls_key_file = /etc/pki/tls/private/postfix.key
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_tls_security_level = may
tls_server_sni_maps = hash:/etc/postfix/sni_map
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual

Hello,

Finally, I get it. Following your returns, I removed the hostname. But this does not change anything. I tried first commenting the line, then removing it in the webmin interface. But no change.I check the hostname. And tried different things.

Rechecking the options, I noticed the option "Rewrite “user” to “user@$mydomain” is set to Yes. During the other test I did, I checked the domain name, which was empty. Then I tried to set this option to No, and everything is working again.

I don’t remember when or why I tried to put this option to yes. But this is the cause of the renaming.

I have reprocessed the essential message in the queue and removed all other noisy emails. I do this manually for each message by doing the following commands:
post -qbh > /tmp/email.eml
cat /tmp/email.eml | sendmail -t

Check that the email arrived in the mailbox, then delete the message in the queue.
I don’t know if there is another way to reprocess the mail queue. The requeue and flush options are doing nothing.

Thanks a lot for your help, which put me in the right direction.

Have a great day,

Robert

1 Like

Everything works if you let it.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.