Test Report E mail Confirmation 1901 - sebiboga/testlink-upgraded GitHub Wiki
Test Report E-mail Confirmation (reportMailSent) — Modernized
Issue: #1901 (enhancement).
This page documents the modernization of the post-send confirmation page shown after a test report is e-mailed from any of the report screens.
Background
Whenever a report was e-mailed (Results by Status, General, by Tester/Build, …),
every one of the ~30 lib/results/*.php controllers funneled through a single
place — the FORMAT_MAIL_HTML branch of lib/results/displayMgr.php
displayReport() — which rendered the Smarty template
gui/templates/dashio/feedback/emailSent.tpl: a header, one message line
(success or mailer error) and nothing else. It was the last standalone full-page
feedback renderer without a modern twin.
The modern screen
gui/templates/results/reportMailSent.html — a standalone Dashio page (no Smarty)
with the shared teal/dark/red palette and the TLi18n locale switcher:
- OK state — green Sent badge, report subject, recipient list, localized success sentence.
- KO state — red Not sent badge, same context rows, and a details box with the (escaped) mailer error.
- No-data state — a bare deep link renders an error bar instead of a blank page.
- Actions: Back to reports, Results navigator, Home, Login, Refresh.




The BFF
api/reportmail/index.php
| Method | Action | Result |
|---|---|---|
GET/HEAD |
?action=context |
{status, action, auth:{logged_in,user_id,user_login,email}, from, to, locale, basehref} |
- Session required →
401 {"status":"error","code":"session_expired"}. - Same-origin proof (
bffSameOriginGuard) →403on a cross-origin POST. - Unknown or array-shaped
action→400; non-GET/HEAD →405. Cache-Control: no-store,X-Content-Type-Options: nosniff.
Link switch
A new helper redirectToReportMailSent() in lib/functions/common.php (sibling of
redirectToInfoPage()) emits a path-only, URL-encoded, same-origin 302 Location
to the modern screen, with a headers_sent() JavaScript fallback.
It is wired into the default branch of the FORMAT_MAIL_HTML case in
lib/results/displayMgr.php displayReport() — the single choke point every
report-mail producer funnels through — so all legacy controllers now land on the
modern screen. The legacy emailSent.tpl is retained only as the
headers-already-sent fallback.
i18n
20 rmail.* keys plus footers.reportMailSent were added to all 10 locale
bundles (en, ro, it, ja, de, pt, ru, fr, zh, es) and validated with
bash ai/verify_i18n_coverage.sh (9/9 PASS, 0 missing).
The prefix
rmail.is deliberate:rms.is already owned by the Requirement Management System screens. The collision was found (a rawrms.headerSubkey was being overridden) and fixed during the port.
Verification
- End-to-end —
GET /api/reportsexport/index.php?action=results_by_status_mail&tplan_id=2&tproject_id=1→303→/lib/results/resultsByStatus.php?format=6&sendSpreadSheetByMail_x=1…&type=f→displayReport()302→reportMailSent.html?status=ko&title=…&msg=<mailer error>renders the modern KO card in the browser. - BFF contract matrix — anon
401, cross-origin403, unknown action400, array action400, context200; verified withcurl. - Helper — URL-encoding (
",&,<, space, newline) and the no-basehreffallback proven via a throwaway served probe. - Suite
Issue #1901— 18/18 PASS, appended totmp/TLU_Test_Cases.md(TLU_REQUIRE_SUITE="Issue #1901" bash ai/verify_test_suites.sh→ 7/7). - Event Viewer — 0 new Error/Warning rows.
Files
| File | Purpose |
|---|---|
gui/templates/results/reportMailSent.html |
modern confirmation screen |
api/reportmail/index.php |
BFF context endpoint |
lib/functions/common.php |
new redirectToReportMailSent() helper |
lib/results/displayMgr.php |
displayReport() FORMAT_MAIL_HTML default branch redirects |
gui/templates/i18n/*.json |
20 rmail.* + footers.reportMailSent in all 10 bundles |