Skip to content

mail: remember SMTP settings for each provider type - #524

Open
t0ma5 wants to merge 1 commit into
mindstellar:developfrom
t0ma5:feat/mailserver-provider-presets
Open

mail: remember SMTP settings for each provider type#524
t0ma5 wants to merge 1 commit into
mindstellar:developfrom
t0ma5:feat/mailserver-provider-presets

Conversation

@t0ma5

@t0ma5 t0ma5 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Mail Settings only stored one live mailserver_* row, so saving Gmail erased Custom and there was no slot for a transactional provider.
  • Server type is now Custom, Gmail, Brevo, SMTP2GO and Amazon SES. Each has its own mailserver_preset_{type} JSON preference. Factory host/port/encryption fill empty fields (no site credentials). Saving one type cannot wipe another: an empty posted slot for an inactive type is ignored.
  • osc_sendMail() still reads the live mailserver_* preferences. The extra slots only park a second provider so you can switch and Save on the one that should send.
  • Gmail still locks host/port to smtp.gmail.com / 465 / ssl. SES uses email-smtp.us-east-1.amazonaws.com as a region placeholder. Docs: docs/site/configure/mail-server.md.

This overlaps Mail Settings JS with #523 (test-email button). Merge that first if both land; rebase this one if mailserver.php conflicts.

Test plan

  • php tests/mailserver-presets.php (normalize/factory/sanitize/merge: saving Brevo does not wipe stored SMTP2GO)
  • Admin → Settings → Mail server: save Gmail, switch to Brevo, fill and save, switch back — Gmail username/password still there
  • After Save on Brevo, site mail actually sends through Brevo (live mailserver_* is the active type)
  • Custom and existing Gmail installs still load without a migration

Made with Cursor

Mail Settings only stored one live mailserver_* row, so saving Gmail erased
Custom and there was no slot for Brevo, SMTP2GO or SES. Each type now has its
own preference; factory host/port fill empty fields; an empty posted slot for
an inactive type cannot wipe a saved one. Live send still reads mailserver_*.

Co-authored-by: Cursor <cursoragent@cursor.com>
@t0ma5
t0ma5 requested a review from navjottomer as a code owner August 25, 2026 16:49
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.

1 participant