Postfix mail server not receiving mail from external domains

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!


@ryankr1 No, you don’t need to do that, since it’s the same server IP, but it would be the correct way to do it.

@hansen Would the MX records have to change to as opposed to ?

@ryankr1 It depends on SPF, DKIM and such. But no, it shouldn’t be a problem. EDIT: Just remember to create an A-record in the DNS for pointing to the server.

@hansen So I set the server name to Then myhostname in postfix. mydomain is then Would there be any other consequences of changing the name?

@ryankr1 Just set myhostname = and work with that.

@hansen So my server is called “”. I did this thinking it was what was necessary for DigitalOcean to generate the PTR records for my domain. I’m not really sure what to do now to fix this problem :/

mydomain is based on myhostname, which in a sense is also wrong, since it’s only a domain. A host name is the computers name. So I have a server called Maria, which would be myhostname = and then it would generate mydomain = You would then make sure there’s an A-record pointing to your hostname.

@hansen I added

mydomain =

to /etc/postfix/ , but postconf -d | egrep "^my" returns the same result. Is there some way to manually propagate this, or am I supposed to be defining it somewhere else?

@hansen Yeah it did seem strange to just take the value co. I’ll update and get back to you :)

@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.

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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?