I can send and receive mail using user@example.com, but system generated emails such as root@mail.example.com bounce backup with an error:

May 1 03:14:52 mail postfix/smtp[62798]: 23CA4BD6B40: to=, relay=none, delay=0.01, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail for mail.example.com loops back to myself)

How do I fix this error?

Postfix did found a dns reply to your email server, but it hasn’t been configured to deal with address such as root@mail.example.com. In other words, your server is configured to accept user@example.com but not as user@mail.example.com. This is well known config problem with virtual domain. To fix this error either add system FQDN to mydestination or relay_domains. Postfix accepts mail for domain listed in virtual_mailbox_domains, virtual_alias_domains, and domains that resolve to IP addresses listed in inet_interfaces and proxy_interfaces. Update mydestination using postconf or by editing main.cf file:

mydestination = localhost.$mydomain, localhost, mail.example.com

Once done reload postfix:
# service postfix reload

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 9 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
9 comments… add one
  • Andrés Chandía Oct 26, 2009 @ 20:40

    I’ve done it but does not works for me, this is what i got:
    at /etc/postfix/main.cf
    myhostname = example.tdl
    myorigin = /etc/mailname
    mydestination = example.tdl, localhost, localhost.localdomain

    at /etc/mailname

    at /etc/hostname

  • zazuge Dec 5, 2012 @ 13:39

    another cause is when you have too mail servers with same hostname
    it happened for me
    watch out for “greeted me with my own hostname”
    @Andrés Chandía
    i don’t think that is a FQDN
    I proper FQDN is “myhost.mydomain.com.”
    or even “myhost.mysubdomain.mydomain.com.”
    though it depends if the trailing dot is inluded or not
    the important thing is that if you do a ping or nslookup
    you get your host (the mail server)
    from anywhere in the interenet (the FQDN must be unique)

  • jomo Jun 2, 2013 @ 21:14

    Thanks — short and sweet answer. Worked for me.

  • Mac Oct 15, 2013 @ 22:15

    Fixed it finally, added in the following:

    mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

    added $mydomain and it worked perfectly!

    • Amjad Jul 9, 2014 @ 5:18

      Worked for Me, Thanks

  • avi Mar 2, 2014 @ 22:40

    Commenting out the line:

    relay =

    will do it too

  • slgarza Jun 11, 2015 @ 16:57

    sorry to nudge and old post, just wanted to drop a line, for webmin what worked for me was:
    What domain to use in outbound mail – use hostname
    Internet hostname of this mail system – myactualdomain.tld
    Local internet domain name – myactualdomain.tld

    in the config file it looks something like this:
    mydomain = myactualdomain.tld
    myhostname = myactualdomain.tld

    hope this helps, worked out for me on EC2

  • my email liop back coded Dec 8, 2015 @ 0:15

    Emails sent to Mr coded to loop back to cc sender

  • Admin Oct 7, 2016 @ 12:58

    Thanks, solved my problem I’d had for a while

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum