Question

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 main.cf file looks like the following:

# 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

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
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 = skytracker.co
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, skytracker.co, localhost.co, , localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/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!

Subscribe
Share

@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 mail.skytracker.co as opposed to skytracker.co ?

@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 mail.skytracker.co pointing to the server.

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

@ryankr1 Just set myhostname = mail.skytracker.co and work with that.

@hansen So my server is called “skytracker.co”. 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 = maria.skytracker.co and then it would generate mydomain = skytracker.co You would then make sure there’s an A-record pointing to your hostname.

@hansen I added

mydomain = skytracker.co

to /etc/postfix/main.cf , 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 = skytracker.co 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 main.cf

so how did you fix the issue mate?