Let me explain what I'm doing and what I want to reach from this postfix multiple instances
I have domain for example "example1.com" and "mail.example1.com" for mail server and has proper DNS MX records and everything is fine, Now I have another domain "example2.com" and "mail.example2.com" for mail server, Each time I send mail from server the mail went to clients SPAM folder and the smtp.mailfrom shows "mail.example1.com"& IP: 1.1.1.1 (for example) at the end I found the newer domain in websites mails blacklist databases, So I searched for a solution but at the end it appears that I must use 2 myhostname by create additional postfix instance to accomplish this and for complete isolation.
I created another instance called "postfix-secondary" via this command:
postmulti -e init
Then created it by this command:
postmulti -I postfix-secondary -e create
After that mad it run via this:
postmulti -i postfix-secondary -p start
The problem now is the emails still forced to go through "mail.example1.com" even with disabled the default mail server and I see it kept gathered in the default queue
I will list the configs now (example1.com) /etc/postfix/main.cf:
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
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination check_sender_access hash:/etc/postfix/mail_blacklist
myhostname = mail.example1.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mail.example1.com, example1.com, localhost.example1.com, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = 1.1.1.1
inet_protocols = ipv4
smtpd_recipient_restrictions = reject_invalid_hostname,
reject_unknown_recipient_domain,
reject_unauth_destination,
reject_invalid_hostname,
reject_non_fqdn_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_sender_domain,
reject_unknown_recipient_domain,
reject_rbl_client sbl.spamhaus.org,
reject_rbl_client cbl.abuseat.org,
reject_rbl_client dul.dnsbl.sorbs.net,
permit
smtpd_helo_restrictions = reject_invalid_helo_hostname,
reject_non_fqdn_helo_hostname,
reject_non_fqdn_hostname,
reject_invalid_hostname,
reject_unknown_helo_hostname
default_process_limit = 100
smtpd_client_connection_count_limit = 10
smtpd_client_connection_rate_limit = 30
queue_minfree = 20971520
header_size_limit = 51200
message_size_limit = 10485760
smtpd_recipient_limit = 100
disable_vrfy_command= yes
smtpd_helo_required = yes
smtpd_delay_reject = yes
smtpd_error_sleep_time = 1s
smtpd_soft_error_limit = 10
smtpd_hard_error_limit = 20
(example1.com) /etc/postfix/master.cf (default)
smtp inet n - - - - smtpd
(example2.com) /etc/postfix-secondary/main.cf
unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
readme_directory = no
inet_protocols = ipv4
#master_service_disable = inet
authorized_submit_users =
queue_directory = /var/spool/postfix-secondary
multi_instance_name = postfix-secondary
myhostname = mail.example2.com
inet_interfaces = 2.2.2.2
multi_instance_enable = yes
mydestination = mail.example2.com, example2.com, localhost.example2.com, localhost
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination check_sender_access hash:/etc/postfix/mail_blacklist
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
relayhost =
mailbox_size_limit = 0
recipient_delimiter = +
#smtp_bind_address = 0.0.0.0
smtpd_recipient_restrictions = reject_invalid_hostname,
reject_unknown_recipient_domain,
reject_unauth_destination,
reject_invalid_hostname,
reject_non_fqdn_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_sender_domain,
reject_unknown_recipient_domain,
reject_rbl_client sbl.spamhaus.org,
reject_rbl_client cbl.abuseat.org,
reject_rbl_client dul.dnsbl.sorbs.net,
permit
smtpd_helo_restrictions = reject_invalid_helo_hostname,
reject_non_fqdn_helo_hostname,
reject_non_fqdn_hostname,
reject_invalid_hostname,
reject_unknown_helo_hostname
default_process_limit = 100
smtpd_client_connection_count_limit = 10
smtpd_client_connection_rate_limit = 30
queue_minfree = 20971520
header_size_limit = 51200
message_size_limit = 10485760
smtpd_recipient_limit = 100
disable_vrfy_command= yes
smtpd_helo_required = yes
smtpd_delay_reject = yes
smtpd_error_sleep_time = 1s
smtpd_soft_error_limit = 10
smtpd_hard_error_limit = 20
append_dot_mydomain = no
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
(example2.com) /etc/postfix-secondary/master.cf (default)
smtp inet n - - - - smtpd
The DNS records for (example1.com) is fine and same as DNS for (example2.com) execpt different domain & IP:
example2.com. IN MX 10 mail.example2.com.
mail.example2.com. IN A 2.2.2.2
example2. IN TXT "v=spf1 mx ip4:2.2.2.2/32 ~all"
_dmarc.example2.com. IN TXT "v=DMARC1; pct=100; p=none; adkim=r; aspf=r"
Thanks in advance