Dear colleagues, Please help me find the mistake or misconfiguration of my postfix/master.cf My main goal is for the domains hosted on the server to send messages from their own domain and not from the servers main domain. Lets say that the servers domain is mail.server.com and the 2 hosted domains are domain1.com and domain2.com with their mail.domain1.com and mail.domain2.com mail server settings. This is all achievable if i use different IP addresses for the hosted domains, but when hosting them all on the same IP address i get: warning: duplicate master.cf entry for service "123.123.123.123:smtp" ([123.123.123.123]:25) -- using the last entry and all the mail is send from the last mentioned mail sender in master.cf the part from /etc/postfix/master.cf 127.0.0.1:smtp inet n - n - - smtpd -o myhostname=localhost -o syslog_name=postfix-localhost -o smtp_helo_name=localhost -o smtp_bind_address=127.0.0.1 -o myhostname=localhost 123.123.123.123:smtp inet n - n - - smtpd -o myhostname=mail.domain1.com -o smtp_bind_address=123.123.123.123 -o syslog_name=postfix-mail.domain1.com -o smtp_helo_name=mail.domain1.com 123.123.123.123:smtp inet n - n - - smtpd -o myhostname=mail.domain2.com -o smtp_bind_address=123.123.123.123 -o syslog_name=postfix-mail.domain2.com -o smtp_helo_name=mail.domain2.com domain1-out unix - - n - - smtp -o smtp_bind_address=123.123.123.123 -o smtp_helo_name=mail.domain1.com -o syslog_name=postfix-mail.domain1.com domain2-out unix - - n - - smtp -o smtp_bind_address=123.123.123.123 -o smtp_helo_name=mail.domain2.com -o syslog_name=postfix-mail.domain2.com
You should not configure Postfix like that. It uses the hostname for all email. Revert the config back to what it was, restart Postfix, and then use the hostname for connecting and sending out e-mails. Eventually add more hostnames. See https://www.howtoforge.com/securing...server-with-a-valid-lets-encrypt-certificate/ and https://www.howtoforge.com/communit...nd-users-connect-to-my-e-mail-services.88472/ as well.
Hi Th0m, thanks for the answer. Yes this is what i would like to achieve, but i couldn't successes with one IP address. Your links doesn't provide the needed solution. The one that i was trying works with separate IP's per domain, but not when they are on the same...
Postfix uses the system hostname when it connects to other systems, not virtual domains hosted on that server. I don't think that you can use the same IP multiple times to bind postfix for them to fake the sender's hostname. You either need one IP per domain or you use a central system hostname as it's normally done on mail systems.
OK thank you for clarification, both of you Th0m and Till. I thought that its possible and that i have some mistake at the settings. Will get back to standard setting with servers hostname and adding it to spf of the domain. Thanks for your time and help