Saving "Debugging and Error Handling" screen sets "Disable outbound mail" for non-Production environments
Overview
Saving the Debugging and Error Handling screen while the Environment field indicates Staging or Production sets the Select Mailer option on the Settings - Outbound Maif screen to Disable outbound mail.
This occurs even when the Environment field is disabled due to the $civicrm_setting['domain']['environment'] variable in civicrm.settings.php.
Example use-case
- Set $civicrm_setting['domain']['environment'] to Staging or Development.
- Click Administer | System Settings | Outbound Email (SMTP/Sendmail) and confirm that the selected Select Mailer option is not Disable Outbound Mail.
- Click Administer | System Settings | Debugging and Error Handling and save the settings without making any changes.
- Click Administer | System Settings | Outbound Email (SMTP/Sendmail) and observe that the Select Mailer option has changed to Disable Outbound Mail.
Current behavior
At the very least, this behavior is contrary to the note in the documentation
This does NOT happen if you have set your Environment via civicrm.settings.php
This was particularly confusing for me because on my staging site, where in civicrm.settings.php the environment is set to Development and CIVICRM_MAIL_LOG is defined to route mail to a file, I went to the "Debugging and Error Handling" screen to simply enable debugging. Some time later I found that outbound mail had been disabled, and was clueless how that could have happened, as I had not changed either the environment mode or the outbound mail mode.
Proposed behavior
The state of the environment should not magically toggle other settings when saving the Debugging and Error Handling screen. Non-Production environments should simply prevent internet email from being sent, while honoring the CIVICRM_MAIL_LOG variable.
Comments
Anything else you would like the reviewer to note.