Postfix mail server not receiving mail from external domains

Posted March 15, 2017 23.4k views
DigitalOceanUbuntu 16.04

I can receive emails that are sent from the server locally, but if I address my server from something like gmail, nothing comes through.

The file looks like the following:

# See /usr/share/postfix/ 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

# TLS parameters
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname,,, , localhost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

# Milter configuration
# OpenDKIM
milter_default_action = accept
milter_protocol = 2
smtpd_milters = local:/opendkim/opendkim.sock
non_smtpd_milters = local:/opendkim/opendkim.sock

Any thoughts are greatly appreciated!

  • Have you created MX-records for your domain? Looking at I’m not seeing any MX-records.

  • @hansen Yeah there are MX records. If you do the following command in the terminal you should see them:

    dig mx
  • @ryankr1 There is a response now, but there wasn’t one earlier when I tested.
    A little strange. When did you add the MX?
    I’m getting this error, when trying to connect: 550 Denied by policy

    Please run this command: postconf -d | egrep "^my"
    And paste the results here.

  • @hansen I added the MX records like a while ago, couple of weeks maybe.

    I just ran your command and got the following:

    mydestination = $myhostname, localhost.$mydomain, localhost
    mydomain = co
    myhostname =
    mynetworks = [::1]/128 [fe80::]/64
    mynetworks_style = ${{$compatibility_level} < {2} ? {subnet} : {host}}
    myorigin = $myhostname

    The mydomain seems wrong, but I’m not sure. Thoughts? Thanks!

  • @ryankr1
    Okay, your mydomain is wrong. It should be mydomain =
    That should fix it, so you can receive mails from the outside to your domain.

  • Show 9 more comments

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

I think your want to replace “postconf -d” with “postconf -p”. The -d option prints the defaults. The -p option shows the current settings. The default options are not sensitive to the contents of

so how did you fix the issue mate?