I am running a Debian 12 server with two additional IP addresses that I want to use for sending emails through my SMTP server.
The main IP address of the server works perfectly for sending and receiving emails, and according to Mail-Tester, everything is set up correctly.
I’ve spent hours trying to configure the master.cf file accordingly, but it just doesn't work.
#submission inet n - y - - smtpd # Diesen allgemeinen Submission Eintrag ersetzen wir # -o syslog_name=postfix/submission # -o smtpd_tls_security_level=encrypt # -o smtpd_tls_auth_only=yes # -o smtpd_enforce_tls=yes # -o smtpd_client_restrictions=permit_sasl_authenticated,reject # -o smtpd_sender_restrictions=reject_sender_login_mismatch # -o smtpd_sender_login_maps=pcre:/etc/postfix/login_maps.pcre # -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_unauth_destination #smtps inet n - y - - smtpd # Diesen allgemeinen SMTPS Eintrag ersetzen wir # -o syslog_name=postfix/smtps # -o smtpd_tls_wrappermode=yes # -o smtpd_sasl_auth_enable=yes smtp unix - - n - - smtp smtp inet n - y - - smtpd # Submission service for IP 192.0.2.1 192.0.2.1:587 inet n - y - - smtpd -o syslog_name=postfix/192.0.2.1-submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions=reject_sender_login_mismatch # oder was du hier brauchst -o smtpd_sender_login_maps=pcre:/etc/postfix/login_maps.pcre # Stellt sicher, dass der User die Absenderadresse nutzen darf -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_unauth_destination -o smtp_bind_address=192.0.2.1 # Wichtig: Ausgehende IP für diesen Service -o smtp_helo_name=smtp1.example.com # Optional, aber gut: HELO Name passend zur IP/PTR # -o myhostname=smtp1.example.com # Optional: Wenn der Hostname pro Service anders sein soll # SMTPS service for IP 192.0.2.1 (Port 465, SSL/TLS wrapper mode) 192.0.2.1:465 inet n - y - - smtpd -o syslog_name=postfix/192.0.2.1-smtps -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions=reject_sender_login_mismatch -o smtpd_sender_login_maps=pcre:/etc/postfix/login_maps.pcre -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_unauth_destination -o smtp_bind_address=192.0.2.1 -o smtp_helo_name=smtp1.example.com # -o myhostname=smtp1.example.com # Submission service for IP 192.0.2.2 192.0.2.2:587 inet n - y - - smtpd -o syslog_name=postfix/192.0.2.2-submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions=reject_sender_login_mismatch -o smtpd_sender_login_maps=pcre:/etc/postfix/login_maps.pcre -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_unauth_destination -o smtp_bind_address=192.0.2.2 -o smtp_helo_name=smtp2.example.com # -o myhostname=smtp2.example.com # SMTPS service for IP 192.0.2.2 192.0.2.2:465 inet n - y - - smtpd -o syslog_name=postfix/192.0.2.2-smtps -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions=reject_sender_login_mismatch -o smtpd_sender_login_maps=pcre:/etc/postfix/login_maps.pcre -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_unauth_destination -o smtp_bind_address=192.0.2.2 -o smtp_helo_name=smtp2.example.com # -o myhostname=smtp2.example.com # Submission service for IP 192.0.2.3 192.0.2.3:587 inet n - y - - smtpd -o syslog_name=postfix/192.0.2.3-submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions=reject_sender_login_mismatch -o smtpd_sender_login_maps=pcre:/etc/postfix/login_maps.pcre -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_unauth_destination -o smtp_bind_address=192.0.2.3 -o smtp_helo_name=smtp3.example.com # -o myhostname=smtp3.example.com # SMTPS service for IP 192.0.2.3 192.0.2.3:465 inet n - y - - smtpd -o syslog_name=postfix/192.0.2.3-smtps -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions=reject_sender_login_mismatch -o smtpd_sender_login_maps=pcre:/etc/postfix/login_maps.pcre -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_unauth_destination -o smtp_bind_address=192.0.2.3 -o smtp_helo_name=smtp3.example.com # -o myhostname=smtp3.example.com -o content_filter=spamassassin #submission inet n - y - - smtpd # -o syslog_name=postfix/submission # -o smtpd_tls_security_level=encrypt # -o smtpd_tls_auth_only=yes # -o smtpd_enforce_tls=yes # -o smtpd_client_restrictions=permit_sasl_authenticated,reject # -o smtpd_sender_restrictions=reject_sender_login_mismatch # -o smtpd_sender_login_maps=pcre:/etc/postfix/login_maps.pcre # -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_unauth_destination #smtps inet n - y - - smtpd # -o syslog_name=postfix/smtps # -o smtpd_tls_wrappermode=yes # -o smtpd_sasl_auth_enable=yes I also commented out the section for the main IP address (192.0.2.1) in master.cf and only kept IPs 2 and 3 in main.cf, but it was still sending emails using IP 1.
Only after I added the following to master.cf:
smtp-ip2 unix - - n - - smtp -o smtp_bind_address=192.0.2.2 -o smtp_helo_name=smtp2.example.com and this in main.cf:
# default_transport = smtp # This is usually the default default_transport = smtp-ip2 did it start sending emails from IP 2.
What I want is that when I configure Thunderbird to use 192.0.2.2 as the SMTP server, the emails are actually sent from that IP. Similarly, if I set it to 192.0.2.3, the emails should be sent from IP 192.0.2.3.