1

I'm trying to run Mac Mini M1 as a SMTP mail server. I have 5 static IPs, each on its own network interface, with 5 different domains (with the corresponding PTR records).

I have installed Webmin successfully, and I'm trying to configure the mail server using Postfix.

Here are the non-default parameters from my main.cf

biff    no
compatibility_level 2
debugger_command    PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory  /usr/share/doc/postfix/html
mail_owner  _postfix
mailbox_size_limit  0
manpage_directory   /usr/share/man
message_size_limit  10485760
mydestination   domain1.org, domain2.com, domain3.net, domain4.net, domain5.org
mynetworks  127.0.0.0/8, [::1]/128
mynetworks_style    subnet
queue_directory /private/var/spool/postfix
readme_directory    /usr/share/doc/postfix
recipient_delimiter +
sample_directory    /usr/share/doc/postfix/examples
sender_dependent_default_transport_maps hash:/etc/postfix/sender_transport
setgid_group    _postdrop
smtpd_client_restrictions   permit_mynetworks permit_sasl_authenticated permit

I've added the 5 domains under mydestination. I successfully receive email for them. As I want every domain name to use its own IP for outgoing email, I've added sender_dependent_default_transport_maps in /etc/postfix/sender_transport which looks like this:

@domain1.org    uniqueid1:
@domain2.org    uniqueid2:
@domain3.net    uniqueid3:
@domain4.com    uniqueid4:
@domain5.net    uniqueid5:

Then in the end of master.cf I've added the following to connect the domains to the IPs:

uniqueid1  unix -       -       n       -       -       smtp
   -o smtp_bind_address=123.123.123.120
   -o smtp_helo_name=domain1.org
   -o syslog_name=postfix-customer-uniqueid1

uniqueid2  unix -       -       n       -       -       smtp
   -o smtp_bind_address=123.123.123.121
   -o smtp_helo_name=domain2.org
   -o syslog_name=postfix-customer-uniqueid2

uniqueid3  unix -       -       n       -       -       smtp
   -o smtp_bind_address=123.123.123.122
   -o smtp_helo_name=domain3.net
   -o syslog_name=postfix-customer-uniqueid3

uniqueid4  unix -       -       n       -       -       smtp
   -o smtp_bind_address=123.123.123.123
   -o smtp_helo_name=domain4.com
   -o syslog_name=postfix-customer-uniqueid4

uniqueid5  unix -       -       n       -       -       smtp
   -o smtp_bind_address=123.123.123.124
   -o smtp_helo_name=domain5.net
   -o syslog_name=postfix-customer-uniqueid5

I've ran postmap hash:/etc/postfix/sender_transport, also I've restarted postfix numerous times.

Every time I try to send an email, it always comes from domain1.org and the first IP corresponding to it 123.123.123.120.

vidarlo
  • 6,654
  • 2
  • 18
  • 31
  • Thank you for your reply. No smtp_bind_address6 in master.cf. I believe this is needed for IPv6, which I do not use? postmap -q user@domain2.example hash:/etc/postfix/sender_transport command returns no results in the Terminal. I'm not sure where the log created by postfix is located in MacOS. – Svetoslav Genov Dec 11 '22 at 01:08
  • My mistake, you have to query just @domain, so something like `postmap -q @domain2.example hash:/etc/postfix/sender_transport` and that should print `uniqueid2:` if the mapping works. – anx Dec 11 '22 at 01:21
  • 1
    It successfully prints the uniqueid for all the 5 domains. So mapping seems to be working/correct. – Svetoslav Genov Dec 11 '22 at 09:46

0 Answers0