WP Multi-site mail issues
When I created a second site on my WP Multi-site setup it had no SMTP config in the new mail plugin(SMTP Mailer). I tried to configure it by copy paste but short of opening up the db or retrieving it from the env var via copy paste I had no way of accessing the SMTP password. Meaning if it ever changed mail would not send. I tried to see if I could setup the config globally but an old discussion confirmed it wasn't possible.
I switched back to WP Mail SMTP and saw it couldn't be configured via the Network UI without the PRO version. But after some digging I confirmed Setting the config via wp_config.php variables works just fine.
define( 'WPMS_ON', true ); // True turns on the whole constants support and usage, false turns it off. define( 'WPMS_MAIL_FROM', getenv('CLOUDRON_MAIL_FROM') ); define( 'WPMS_MAIL_FROM_FORCE', true ); // True turns it on, false turns it off. //define( 'WPMS_MAIL_FROM_NAME', 'From Name' ); define( 'WPMS_MAIL_FROM_NAME_FORCE', true ); // True turns it on, false turns it off. define( 'WPMS_MAILER', 'smtp' ); // Possible values: 'mail', 'smtpcom', 'sendinblue', 'mailgun', 'sendgrid', 'gmail', 'smtp'. define( 'WPMS_SET_RETURN_PATH', true ); // Sets $phpmailer->Sender if true, relevant only for Other SMTP mailer. define( 'WPMS_SMTP_HOST', getenv('CLOUDRON_MAIL_SMTP_SERVER')); // The SMTP mail host. define( 'WPMS_SMTP_PORT', getenv('CLOUDRON_MAIL_SMTP_PORT') ); // The SMTP server port number. define( 'WPMS_SSL', '' ); // Possible values '', 'ssl', 'tls' - note TLS is not STARTTLS. define( 'WPMS_SMTP_AUTH', true ); // True turns it on, false turns it off. define( 'WPMS_SMTP_USER', getenv('CLOUDRON_MAIL_SMTP_USERNAME') ); // SMTP authentication username, only used if WPMS_SMTP_AUTH is true. define( 'WPMS_SMTP_PASS', getenv('CLOUDRON_MAIL_SMTP_PASSWORD') ); // SMTP authentication password, only used if WPMS_SMTP_AUTH is true. define( 'WPMS_SMTP_AUTOTLS', true ); // True turns it on, false turns it off.
This config means everything is configured across all sites in the install and each site can individually set the"From Name".
This seems like a much better default for the multi-site setup. The only thing that's not ideal is it'd be nice to be able to allow sending from different from address, including different domains configured in cloudron. username and password doesn't have to change but allowing different from address would be nice.
@girish Just read why you switched the plugin to SMTP Mailer...is there a solution I haven't found that can be used with that plugin?
@moonmeister Oh, I wasn't aware of this limitation of that plugin. I replaced the email plugin before we enabled multi-site. Maybe, we have to use some other friendlier plugin in multi-site mode. Let me check.
@moonmeister I looked into this more closely and found some issues in the package. It seems all the plugins need to be network activated (like redis/ldap). And also, mail plugin probably has to auto-configured for all the sites. I will make the changes.
scooke last edited by
@girish Are you sure that auto-activating all plugins is the best thing? From what I recall from my own install, plugins can be installed "centrally", but it is best to activate each per site. This is something the user needs to learn about, and do.
Or are you talking about enabling the ability to active plugins for all sites?
@scooke Good question. Don't you think plugins like LDAP and Redis should be network activated when multi-site mode is enabled? Thing is the package needs to be have some logic to configure plugins in multi-site mode (i.e one has to loop through all the sites and set the LDAP configuration).
In my opinion it should be up to the network admin to decide which plugins to activate network-wide. The two you mentioned I would see as exceptions though. Email in particular needs to be configurable on a per-subsite basis.
Incidentally, I personally prefer this plugin for mail: https://postmansmtp.com/
@ccfu Yes, that's the plan. Only the ldap and redis plugin are network activated. Nothing else. For LDAP, if you don't want it, you can of course just opt out of cloudron user management at install time.
As for email, in the next release (of Cloudron), you can opt out of email configuration as well.
What if you placed them as MU-plugins?
I have tried to fix this in the latest package - https://docs.cloudron.io/apps/wordpress-developer/#email-setup-multisite . I pushed the update last week but it's been rolling out slowly. A new install (which is required for multi-site) will get the latest package.