I have installed a send only postfix. Postfix works when I send a mail to a full email address. However, if a mail to sent to a user, it adds the FQDN name as the extension instead of just the domain name I have set-up during installation.
For example, when I send a mail from ssh like this:
echo "This will go into the body of the mail." | mail -s "Hello world" root
I want the mail to go to root@example.com.au
. But the email is sent to root@host.example.com.au
.
I have reviewed my host settings, mailname settings, postfix settings and I have no clue on why it keeps adding the full hostname to it which obviously is getting bounced. Here are my config files:
Postfix main.cf:
# 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 (Debian/GNU)
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.
myhostname = host.example.com.au
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
virtual_alias_maps = hash:/etc/postfix/virtual
Aliases:
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
/etc/postfix/virtual:
root admin@example.com.au
/etc/mailname:
example.com.au
/etc/hosts:
127.0.0.1 localhost
11x.0.0.xxx host.example.com.au host
/etc/hostname
host
I have reviewed everything and I dont have a clue on why mail send to @host.example.com.au
. Can someone help me here please?
I am on debian 8.
EDIT:
Just now, I tried adding one more setting to main.cf file: masquerade_domains = $mydomain
. Adding this seems to fix the from
address to show my domain name instead of hostname but yet, the to
address is still having the FQDN name. I am receiving the bounced email "Mail Delivery System" notification on my email address since the origin email is now right after adding the masquerade_domains
, but still cant get my head around why the user email is not respecting the same and the to
address is still addressed as root@host.example.com.au
instead of root@example.com.au
.
myhostname = host.example.com.au
mydomain = example.com.au
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $mydomain
masquerade_domains = $mydomain
mydestination =
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128