diff --git a/TODO.md b/TODO.md index 0600160..6edb4d7 100644 --- a/TODO.md +++ b/TODO.md @@ -4,3 +4,4 @@ - [x] Make `.repertoire-col` columns scrollable instead of `.search-main` - [x] Replace JS toast system with pure HTMX toast fragment (top-right, CSS-only auto-fade) - [x] Separate admin views from controllers: move all HTML to `templates/admin/*.php`, fragments to `templates/admin/partials/` +- [x] Add SMTP test email button in parametres.php (action + CSS) diff --git a/app/public/admin/actions/smtp-test.php b/app/public/admin/actions/smtp-test.php new file mode 100644 index 0000000..9b7eb5c --- /dev/null +++ b/app/public/admin/actions/smtp-test.php @@ -0,0 +1,64 @@ + + +

+ Test d'envoi SMTP — Post-ERG +

+

Ceci est un e-mail de test envoyé depuis l'interface d'administration de Post-ERG.

+

Si vous recevez ce message, la configuration du relay SMTP est correcte.

+
+

+ Envoyé le : $sentDate
+ Destinataire : $toSafe +

+ + +HTML; + +$ok = SmtpRelay::send($db, $to, $subject, $body); + +if ($ok) { + App::flash('success', "E-mail de test envoyé à \u00ab\u00a0{$to}\u00a0\u00bb."); +} else { + App::flash('error', "Échec de l'envoi. Vérifiez la configuration SMTP et les logs serveur."); +} + +header('Location: /admin/parametres.php'); +exit; diff --git a/app/public/assets/css/admin.css b/app/public/assets/css/admin.css index f5cf26f..d8d8858 100644 --- a/app/public/assets/css/admin.css +++ b/app/public/assets/css/admin.css @@ -1483,6 +1483,47 @@ label:has(+ div > input:required)::after { /* ── SMTP section ─────────────────────────────────────────────────────── */ +.param-smtp-test { + margin-top: var(--space-m); +} +.param-smtp-test-form { + margin-top: var(--space-s); +} +.param-smtp-test-row { + display: flex; + align-items: flex-end; + gap: var(--space-s); + flex-wrap: wrap; +} +.param-smtp-test-row > div { + flex: 1 1 260px; +} +.param-smtp-test-row label { + display: block; + font-size: var(--step--1); + font-weight: 600; + margin-bottom: var(--space-2xs); + color: var(--text-secondary); +} +.param-smtp-test-row input[type="email"] { + width: 100%; + padding: var(--space-xs) var(--space-s); + border: 1px solid var(--border-primary); + border-radius: 4px; + background: var(--bg-primary); + color: var(--text-primary); + font-size: var(--step--1); + box-sizing: border-box; +} +.param-smtp-test-row input[type="email"]:focus { + outline: 2px solid var(--accent-primary); + outline-offset: 1px; +} +.param-smtp-test-row > button { + white-space: nowrap; + flex-shrink: 0; +} + .param-smtp-status { display: flex; align-items: center; diff --git a/app/storage/posterg.db b/app/storage/posterg.db index db4042c..23b4b12 100644 Binary files a/app/storage/posterg.db and b/app/storage/posterg.db differ diff --git a/app/storage/test.db b/app/storage/test.db index c1f51a0..2425954 100644 Binary files a/app/storage/test.db and b/app/storage/test.db differ diff --git a/app/templates/admin/parametres.php b/app/templates/admin/parametres.php index cc3ef09..9e58c96 100644 --- a/app/templates/admin/parametres.php +++ b/app/templates/admin/parametres.php @@ -186,6 +186,27 @@ + + +
+ Tester l'envoi d'un e-mail +

Envoie un e-mail de test via le relay SMTP configuré ci-dessus.

+ +

⚠ Configurez le relay SMTP avant de pouvoir tester l'envoi.

+ +
+ +
+
+ + +
+ +
+
+ +