Skip to content

mail: stop PHPMailer waiting five minutes on a dead SMTP host - #523

Open
t0ma5 wants to merge 1 commit into
mindstellar:developfrom
t0ma5:fix/phpmailer-smtp-timeout
Open

mail: stop PHPMailer waiting five minutes on a dead SMTP host#523
t0ma5 wants to merge 1 commit into
mindstellar:developfrom
t0ma5:fix/phpmailer-smtp-timeout

Conversation

@t0ma5

@t0ma5 t0ma5 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • PHPMailer's default Timeout is 300 seconds. A firewalled or mistyped SMTP host then holds a php-fpm worker for five minutes per osc_sendMail() call (and per a hung Mail Settings test).
  • Cap connect and command waits at 15 seconds. Plugins can change it with the phpmailer_smtp_timeout filter; the value is clamped to 1–60.
  • Restore the Mail Settings Send a test email button (the JS was still there; the markup was not) and abort that request after 25 seconds.

Test plan

  • php tests/phpmailer-smtp-timeout.php (pins the 15s default, SMTP Timeout/Timelimit, and the 1–60 clamp)
  • Admin → Settings → Mail server: Send a test email to a working SMTP host still delivers
  • Point hostname at a black hole / closed port: the test fails in ~15–25s instead of hanging until the browser gives up

Made with Cursor

PHPMailer's default Timeout is 300 seconds, so a firewalled or mistyped SMTP
host held a php-fpm worker for five minutes per send. Cap connect and command
waits at 15 seconds (filter phpmailer_smtp_timeout, clamped to 1-60). Restore
the Mail Settings test-email button, which still had JS but no markup, and
abort that request after 25 seconds.

Co-authored-by: Cursor <cursoragent@cursor.com>
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