PB-2301: Email sent while the visitor waits
Paul Bunyan code PB-2301 (Warning): Email sent while the visitor waits. What it means and what to do.
On this page
What it means
An email was handed to the mail system during a page or AJAX request, and the visitor waited for it.
What to do
Send it in the background. For WooCommerce order emails, turn on deferred transactional emails. A dedicated SMTP service is also usually quicker than the server's own mail program.
Common causes
- WooCommerce order emails sent during checkout, so the buyer waits for the mail server before seeing the thank-you page.
- Contact or registration forms that send mail before answering the visitor.
- The server's own mail program (
sendmail) being slow to accept messages. - An SMTP server that is slow to connect, or a wrong port that waits for a timeout.
How to find and fix it
- The details show how long the email took to build and how long the mail system took to accept it. If most time is the hand-off, the mail system is the problem, not the code.
- For WooCommerce, turn on deferred transactional emails so order emails go out in the background.
- Use a dedicated SMTP or email API service; they usually accept a message in well under a second.
- For your own forms, queue the email in a background job and answer the visitor first.
Details
| Code | Severity | Group |
|---|---|---|
| PB-2301 | Warning |
