Score:0

Postfix relay error "mail for example.com loops back to myself"

al flag

Good afternoon. There is a mail server (smtp relay) on ubuntu 22.04. This is the core of the server. There are mail accounts on Google Workspace, and the transfer of outgoing letters from these accounts to the created smtp server is configured. Everything is sent from corporate mail(Google workspace) without problems, the relay works correctly. However, when I try to send mail (from any mailbox) to a corporate mailbox, I get an error "mail for example.com loops back to myself".

I provide my server configuration. Ubuntu 22.04 Postfix version 3.6.4

Could you suggest what is the problem? Thank you

main.cf

# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
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 3.6 on
# fresh installs.
compatibility_level = 3.6
# TLS parameters
smtpd_tls_cert_file=/etc/letsencrypt/live/example.com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/example.com/privkey.pem
smtpd_tls_security_level=may
smtp_use_tls=yes
smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, check_relay_domains
myhostname = mail.example.com
mydomain = mail.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.$mydomain, localhost, example.com
relayhost =
relay_domains = gmail.com, google.com, mail.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 35.190.247.0/24 64.233.160.0/19 66.102.0.0/20 66.249.80.0/20 72.14.192.0/18 74.125.0.0/16 108.177.8.0/21 173.194.0.0/16 209.85.128.0/17 216.58.192.0/19 216.239.32.0/19 [2001:4860:4000::]/36 [2404:6800:4000::]/36 [2607:f8b0:4000::]/36 [2800:3f0:4000::]/36 [2a00:1450:4000::]/36 [2c0f:fb50:4000::]/36 172.217.0.0/19 172.217.32.0/20 172.217.128.0/19 172.217.160.0/20 172.217.192.0/19 172.253.56.0/21 172.253.112.0/20 108.177.96.0/19 35.191.0.0/16 130.211.0.0/22
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4

milter_protocol = 2
milter_default_action = accept
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891

DNS domain records:

example.com
MX
5 alt2.aspmx.l.google.com. 
5 alt1.aspmx.l.google.com 
10 alt4.aspmx.l.google.com.
2 aspmx.l.google.com.
10 alt3.aspmx.l.google.com.
1 mail.example.com

mail.example.com
A
0.0.0.0(example)
HBruijn avatar
in flag
In many cases mentioning the actual domain name is essential for the community to be able to help diagnose DNS issues. This may be one too. Please refer to [this Q&A](http://meta.serverfault.com/q/963/37681) for our recommendations with regards to how and what (not) to obfuscate in your questions.
HBruijn avatar
in flag
When your organisations mailboxes are hosted on Google Workspace you typically don't have mailboxes for `@example.com` addresses on your own Ubuntu server and shouldn't point a MX record for example.com to your own server. = Remove the `MX` record pointing to `mail.example.com` and the error should go away.
Tarik avatar
al flag
Thanks for the help! I removed the mx mail.example.com entry and left the google mail servers value. So far I don't see the problem. The values I left: 5 alt2.aspmx.l.google.com. 5 alt1.aspmx.l.google.com. 10 alt4.aspmx.l.google.com. 1 aspmx.l.google.com. 10 alt3.aspmx.l.google.com.
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.