How to configure postfix to use domain.tld instead of host.tld

8 posts / 0 new
Last post
#1 Mon, 11/05/2018 - 06:24

How to configure postfix to use domain.tld instead of host.tld

In my setup, I am using postfix for emails, I had configured my Virtualmin to use sender IP for outgoing emails (I follow this tutorial: Now see the following result. hostname = (IP: (rdns > (this hostname hosting multiple virtual domains on dedicated IP addresses.) virtual domain = (IP: (rdns > (set up for dependent address) When I send an email from this virtual domain, email header contains: sent from: It should contain: sent from:

Here is a piece of Header copied from Gmail: Gmail give two different lines. Received: from ( []) Received: from (unknown []) by (Postfix) with ESMTPSA id 98XXXX46BD1 for; Sat, 3 Nov 2018 18:23:36 +0100 (CET)

In I got this error: Your IP address is associated with the domain Nevertheless, your message appears to be sent from

How should I correct this? Any help will be greatly appreciated.

Mon, 11/05/2018 - 06:31

Can you post your file here?

Tue, 11/06/2018 - 07:08 (Reply to #2)

I had posted my file. Can you please review it to solve the issue?

Faheem Khan

Mon, 11/05/2018 - 07:54

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/postfix/postfix.cert.pem smtpd_tls_key_file = /etc/postfix/postfix.key.pem 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.

sender_dependent_default_transport_maps = hash:/etc/postfix/dependent 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 virtual_alias_maps = hash:/etc/postfix/virtual sender_bcc_maps = hash:/etc/postfix/bcc mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME home_mailbox = Maildir/ smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_recipient_restrictions = check_policy_service inet: permit_mynetworks permit_sasl_authenticated reject_unauth_destination check_policy_service inet: smtp_tls_security_level = dane allow_percent_hack = no smtpd_tls_CAfile = /etc/postfix/ smtpd_tls_security_level = may smtpd_tls_mandatory_ciphers = high milter_default_action = accept milter_protocol = 2 smtpd_milters = inet:localhost:8891 non_smtpd_milters = inet:localhost:8891 message_size_limit = 102400000

smtpd_sender_restrictions = check_policy_service inet:

smtpd_end_of_data_restrictions = check_policy_service inet:

Faheem Khan

Mon, 11/05/2018 - 14:37

In, change anything that says to and restart postfix.

When postfix is greeting other mail servers it is saying it is, however your dns says it is This raises all kinds of "spammy" flags at the other mailservers. Just set postfix to tell them it is actually Postfix and the other servers can deal with the fact that you are sending email addressed as from without postfix needing to pretend it is in that domain.

Tue, 11/06/2018 - 07:07 (Reply to #5)

@noisemarine I have multiple domains eg,, how can I achieve this for all virtual domains.

Faheem Khan

Wed, 11/07/2018 - 04:13 (Reply to #6)

My apologies. I misread your issue.

Does the file /etc/postfix/dependent contain any entries? If so, they should line up with entries in /etc/postfix/ Is that the case?

ie. " smtp_domain1:" should have an entry in like "smtp_domain1 unix - - n - - smtp -o smtp_bind_address="

Stupid question, but did you restart postfix after making your changes?

Tue, 11/06/2018 - 07:18

I will post my file to see if that helps you in something...

# /etc/postfix/
# Author: Marcelo Pavan
# Website:
# Dovecot version: 2.2.35
# Postfix version: 3.2.5

# Default
compatibility_level = 2
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname =
mydomain =
inet_interfaces = all
inet_protocols = ipv4
mydestination =,,
unknown_local_recipient_reject_code = 550
mynetworks_style = host
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
     ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix32u-3.2.5/samples
readme_directory = /usr/share/doc/postfix32u-3.2.5/README_FILES
meta_directory = /etc/postfix
shlib_directory = /usr/lib64/postfix

# Virtualmin
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
sender_dependent_default_transport_maps = hash:/etc/postfix/dependent
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
home_mailbox = Maildir/
mailbox_size_limit = 0
allow_percent_hack = no
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous, noplaintext
smtpd_sasl_tls_security_options = noanonymous
smtpd_relay_restrictions =

smtpd_recipient_restrictions =
check_policy_service unix:/var/spool/postfix/postgrey/socket

smtpd_use_tls = yes
smtpd_tls_security_level = may
smtp_tls_security_level = may
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/marcelorp/mail/mail.crt
smtpd_tls_key_file = /etc/marcelorp/mail/mail.key
smtpd_tls_mandatory_protocols = !SSLv2,!SSLv3,!TLSv1,!TLSv1.1
smtpd_tls_mandatory_ciphers = medium

# master.conf
smtpd_reject_unlisted_recipient = no
milter_macro_daemon_name = ORIGINATING

# End

Please, note that I'm using a updated version of postfix and dovecot. If you want to get an newer version I can explain how, but some other users did not recommend to install newer from non-oficial centos repository...and here I'm forcing an SSL connection to my SMTP service.

Another thing...if you can post you with a code formating to other users can help you and understand more your configuration settings...

Topic locked