Question
Having issues with Postfix sending out as user@hostname rather than user@domain.com
- I keep getting issues where postfix keep trying to send out as the hostname
- Is there a way to send out emails if the username is not on the server?
I’ve been following this guide: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-16-04 and looked through the comments. I’ve ended up adding
masquerade_domains = domain.com
myhostname = domain.com
mydomain = domain.com
And I checked /etc/mailname and it only has domain.com in it.
Logs
Jun 9 20:03:50 web-server postfix/master[2276]: terminating on signal 15
Jun 9 20:03:51 web-server postfix[2436]: Postfix is running with backwards-compatible default settings
Jun 9 20:03:51 web-server postfix[2436]: See http://www.postfix.org/COMPATIBILITY_README.html for details
Jun 9 20:03:51 web-server postfix[2436]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
Jun 9 20:03:51 web-server postfix/master[2473]: daemon started -- version 3.1.0, configuration /etc/postfix
Jun 9 20:03:56 web-server postfix/pickup[2474]: D62F51710A: uid=1001 from=<user@web-server>
Jun 9 20:03:56 web-server postfix/cleanup[2480]: D62F51710A: message-id=<20170609200356.D62F51710A@domain.com>
Jun 9 20:03:56 web-server postfix/qmgr[2475]: D62F51710A: from=<user@web-server>, size=406, nrcpt=1 (queue active)
Jun 9 20:03:57 web-server postfix/smtp[2482]: D62F51710A: to=<user.name@gmail.com>, relay=gmail-smtp-in.l.google.com[209.85.201.26]:25, delay=0.43, delays=0.05/0.06/0.17/0.15, dsn=2.0.0, status=sent (250 2.0.0 OK 1497038637 w195si1953813qkb.93 - gsmtp)
Jun 9 20:03:57 web-server postfix/qmgr[2475]: D62F51710A: removed
/etc/postfix/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
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.
masquerade_domains = domain.com
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = domain.com
mydomain = domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, domain.com, localhost, localhost.localdomain, localhost
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
inet_protocols = all
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.
×