Skip to content

fix(settings): a fresh install's first settings save no longer turns off every email - #194

Merged
Panelica merged 2 commits into
Panelica:mainfrom
ertugrulkeyvan:fix/mail-enabled-default
Oct 16, 2026
Merged

Panelica merged 2 commits into
Panelica:mainfrom
ertugrulkeyvan:fix/mail-enabled-default

Conversation

@ertugrulkeyvan

Copy link
Copy Markdown
Contributor

What

Found on a fresh 1.5.0 install from install.sh (Rocky Linux 9, also true on main): the first save of Setup -> General turns off all outgoing email, and the test email button still says the email was sent.

  1. The checkbox and the mailer disagree. SuppressMailWhenDisabled treats an unset MailEnabled as on, so a fresh install sends mail. The settings page ticks "Enable outgoing emails" only when the value is '1'. On a fresh install the box therefore looks off. Saving the page for any other field (company name, address) posts the hidden 0, and from then on every invoice, reminder, order confirmation and password reset is cancelled. The only trace is an info line in the log: "Outgoing mail suppressed".
  2. The test button hides it. Mail::raw() returns null when a MessageSending listener cancels the send, and the button reported that as "Test email sent".

On the test server: fresh install, wizard, saved the General page once with the mail fields only, pressed the test button. The answer was "sent (via sendmail)"; Postfix never saw a message, and settings.MailEnabled was 0.

How

  • One reading of the switch: SuppressMailWhenDisabled::isOn() holds the rule the listener already used (empty means on; 0, false, off, no mean off). The listener and the checkbox both use it.
  • The test button: when the send was cancelled, it answers success: false with "outgoing email is turned off on this page", or "a mail hook cancelled it" when the switch is on and something else stopped it. Two new keys, admin.settings.test_email_mail_off and admin.settings.test_email_cancelled, in en, tr, de, pl and zh.
  • Existing installations: a stored 0 is left alone, since it may be a deliberate choice. Those operators now see the box unticked, which is what their mail is doing, and the test button tells them.

Tests

tests/Feature/MailEnabledSwitchTest.php, four new tests (seven cases); three fail on main and pass here:

  • a never-set switch is drawn ticked;
  • the switch is drawn from the stored value: 1 and true ticked, 0 and false not;
  • the test button reports a cancelled send instead of "sent", and nothing is delivered;
  • the test button still reports a test email that went out.

Full suite: 4229 passed. The one failure is the CurrencyAndBackupTest db backup test, which fails on main too in my local setup.

…off every email

The mailer treats an unset MailEnabled as on, but the General settings page
ticked its "Enable outgoing emails" box only for '1'. On a fresh install the
box looked off, and the first save of the page, for any field, wrote '0':
every invoice, reminder and password reset was then cancelled, with only an
info line in the log. The page now reads the switch the way the mailer does,
through SuppressMailWhenDisabled::isOn().
Mail::raw() returns null when a MessageSending listener cancels the send, and
the button reported that as sent. With outgoing email switched off it now
says so; when a mail hook cancelled it, it says that.
Panelica pushed a commit that referenced this pull request Oct 16, 2026
Spanish is a community language kept at 100%: settings.test_email_mail_off and settings.test_email_cancelled, so the test button does not fall back to English.
@Panelica
Panelica merged commit 77d59ff into Panelica:main Oct 16, 2026
1 check passed
@Panelica

Copy link
Copy Markdown
Owner

Thank you @ertugrulkeyvan, merged in 77d59ff. A silent "every email off" after the first save of the settings page is exactly the kind of thing that is hard to notice until invoices stop arriving, so this is a valuable find.

What we checked:

  • Of your new tests, three fail on main (the never-set switch drawn ticked, true drawn ticked, the test button reporting a cancelled send) and all twelve in MailEnabledSwitchTest pass with your change.
  • MailEnabled is read only by the listener, the settings page and the test button, and all three now go through SuppressMailWhenDisabled::isOn(). A stored 0 stays as it is.
  • On top of it we added 76ee07d: the two new messages in Spanish, which we keep at 100%.

Full suite on the merged branch (with #195): 4230 passed, 3 skipped, 0 failed. The CurrencyAndBackupTest failure did not occur here.

This will be part of the next release.

Panelica pushed a commit that referenced this pull request Oct 21, 2026
Selling Panelica licenses with a partner account (the Panelica Licenses page, the module, the customer's own install command), knowledge base and announcements in more than one language (#201, #203), the knowledge base search (#202), retrying a refused domain registration (#197), keeping the card that paid (#209), reports and statuses in the admin's language (#208, #205), the Panelica module's messages in the customer's language (#199), the registrant's phone on domain orders (#196), panel sign-in by name (#200), and the fixes of #193, #194, #195, #198, #204, #206 and #207. Database: three new translation tables. A MINOR beta, the second of 1.6.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants