Skip to content

How to configure SMTP relay services like SMTP2GO?

One method of self-hosting Mail is to host the reception part (confirmed using this package, works great) but use an SMTP relay service like https://www.smtp2go.com/ or https://sendgrid.com/ to handle the E-Mail sending without being labled as spam, when things like a static IP & reverse DNS cannot be setup. (In my case, my German ISP can give me a static IP and reverseDNS but the prices are insane, plus it's still not guaranteed that E-Mails won't become spam due to IP Reputation.) I use SMTP2GO and all my Mails are delivered successfully.

I can input the SMTP2GO info directly into my mail program, works great, but that means login isn't handled by this package anymore and the SMTP2GO login allows sending E-Mail as any E-Mail, which means I can't have multiple users.

SMTP2GO has a guide on how to configure postfix to act as a relay: https://www.smtp2go.com/setupguide/postfix/

So, how can I configure this package to use SMTP2GO as an SMTP Relay and still work with the user login provided by this package, instead of using the SMTP2GO login info in a declarative way? Reading through https://nixos-mailserver.readthedocs.io/en/latest/options.html I don't see anything regarding postfix configuration except messageSizeLimit and ldap

Edited by Wladislav Artsimovich