Postfix not sending to the right domain

Hi, I've setup postfix using the guide in the wiki. My mails are going to the wrong place. Instead of going to user@domain.com, its going to user@hostname.domain.com.

Here is my 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

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_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.

myhostname = mugen.ext9.org
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mugen.ext9.org, localhost.ext9.org, localhost.localdomain, localhost, ext9.org
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
home_mailbox = Maildir/
smtpd_sasl_local_domain =
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom

and here is my /etc/host

127.0.0.1 localhost.localdomain localhost
#67.18.187.77 mugen.ext9.org mugen

# The following lines are desirable for IPv6 capable hosts
# (added automatically by netbase upgrade)

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

and /etc/hostname

mugen.ext9.org

How do I fix this? Thanks

4 Replies

What do mean "mails are going to the wrong place"? Mails you send from an external host? Mails sent from the same host? Your postfix setup says it should accept mails addressed to either @hostname.domain.com or @domain.com equally well. (that's what the mydestinations parameter does)

What's in /etc/mailname?

Oh, and your DNS setup is broken – your MX record for ext9.org points to mail.ext9.org, but there's not A record for that. Is that what you were saying, that you

could send mail to hostname.domain.com, but not domain.com? The DNS problem would explain that.

/etc/mailname == ext9.org

> that you

could send mail to hostname.domain.com, but not domain.com? The DNS problem would explain that.

Exactly what I mean. I've changed my MX record to mugen.ext9.org. Hope this works.

Your DNS looks good now. BTW, what I did was:

$ dig -t MX ext9.org
; <<>> DiG 9.3.4 <<>> -t MX ext9.org
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64405
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:
;ext9.org.                      IN      MX

;; ANSWER SECTION:
ext9.org.               7200    IN      MX      0 mugen.ext9.org.

;; AUTHORITY SECTION:
ext9.org.               7190    IN      NS      ns3.zoneedit.com.
ext9.org.               7190    IN      NS      ns9.zoneedit.com.

;; ADDITIONAL SECTION:
mugen.ext9.org.         7190    IN      A       67.18.187.77
ns3.zoneedit.com.       20952   IN      A       72.51.43.223

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct