In the settings.php for my local environment, I am overriding the SMTP settings to ensure that it is "on" by default:

$config['smtp.settings']['smtp_on'] = TRUE;

I also have the system mail set to "SMTPMailSystem" by default. However, if I got to the SMTP configuration page and save the settings, then the system resets my mail interface to "php_mail". The reason why is that the code in the submit handler for the form is checking the value of "smtp_on" from the editable config, not the overridden config. So it treats SMTP as disabled and thus resets my system mail to php_mail.

CommentFileSizeAuthor
#3 2881235-mail-system-reset-3.patch561 bytesmrkdboyd

Comments

mrkdboyd created an issue. See original summary.

mrkdboyd’s picture

Title: Mail system should not be updated if SMTP on/off is overridden » Mail system should not be reset if SMTP on/off is overridden
mrkdboyd’s picture

Status: Active » Needs review
StatusFileSize
new561 bytes

Here is a patch to fix the issue. I'm checking to see if "smtp_on" is overridden and if the value from the form for "smtp_on" is "on". If so, then SMTP is being set to "on" via overrides and we don't want to reset the mail system to the default system mail.

asrob’s picture

Status: Needs review » Reviewed & tested by the community

I successfully applied this patch and looks good to me therefore RTBC'ed!

chris matthews’s picture

Version: 8.x-1.0-beta2 » 8.x-1.x-dev

The patch in #3 was RTBC'd 2 years ago and still applies cleanly to 8.x-1.x-dev. Can this be committed?

git apply -v 2881235-mail-system-reset-3.patch
Checking patch src/Form/SMTPConfigForm.php...
Hunk #1 succeeded at 315 (offset 65 lines).
Applied patch src/Form/SMTPConfigForm.php cleanly.
wundo’s picture

wundo’s picture

Status: Reviewed & tested by the community » Fixed

Fixed, thanks for the follow up

  • wundo committed 0910fef on 8.x-1.x authored by mrkdboyd
    Issue #2881235 by mrkdboyd, asrob, Chris Matthews: Mail system should...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.