[Best practices] Different mail settings per site

Then this boils down to two problems:

  1. The MTA in question (ssmtp) doesn’t support multiple accounts to send from.
  2. Even if a MTA is used that offers support for multiple accounts, WordPress core still has to communicate which account it should use, including proper auth, so not another account can be used from - which could be changed in the WordPress configuration.

When multiple sites are used, I think the only the way is using a WordPress plugin for directly configuring the WordPress SMTP settings.

Edit: A plugin is actually not low level enough. In a better, hybrid approach Trellis generates an .env file with the mail config - either localhost for the classic SSMTP setup - or with custom SMTP config - and some WordPress code applies these settings.
Programmatic way for configuring WordPress SMTP settings: https://wordpress.stackexchange.com/questions/75956/whats-the-easiest-way-to-setup-smtp-settings-programmatically

2 Likes