I have a VPS with a sendmail instance on it which is used to deliver mail from a few Wordpress sites that I host. The sendmail is on the same machine as the Wordpress sites and I'm keen to keep it that way for quicker local mail hand-off. The sendmail server listens only for local connections and is also firewalled from incoming connections.
Two of my clients use G-Suite and one uses Office 365. Both of these are capable of receiving mail to relay on, provided that they have been configured to trust the IP address of the machine sending. Others send directly and have whitelisted this server in their SPF records.
Is it possible to configure sendmail to automatically listen on additional ports and then smarthost the mail sent via a particular port onward to a particular service?
G-Suite has a single relay point (smtp-relay.gmail.com) whereas each O365 domain has its own unique domain example-com.mail.protection.outlook.com. I don't mind configuring each port/smarthost combination, but want to know if its possible, and if so, how to configure this.
- mail incoming on 25: queued for direct delivery.
- mail incoming on 26: relayed to smtp-relay.gmail.com
- mail incoming on 27: relayed to example-com.mail.protection.outlook.com
- mail incoming on 28: relayed to example2-com.mail.protection.outlook.com
I would then configure each of the mail sending instances to talk to a specific port:
- Customer A: 127.0.0.1:25
- Customer B: 127.0.0.1:27