Troubleshooting FluentSMTP: Fixing Failed Email Resend and JavaScript Errors
Content
Many users of the FluentSMTP plugin encounter a frustrating issue: the inability to resend failed emails. When clicking the "Resend" or "Retry" button in the logs, the page often freezes, requiring a refresh. This problem is frequently accompanied by specific JavaScript errors in the browser's console and sometimes even PHP fatal errors in server logs.
Common Error Messages
Users report seeing a variety of errors when this problem occurs:
- JavaScript Console Errors:
Uncaught TypeError: Cannot read properties of undefined (reading 'data')Uncaught TypeError: t.responseJSON is undefined
- PHP Fatal Error (in server logs):
PHP Fatal error: Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in .../wp-includes/PHPMailer/PHPMailer.php
- Generic AJAX/Server Errors: A blank screen or a generic "There has been a critical error on this website" message.
Why This Happens
Based on community reports, this issue is not caused by a single factor but often stems from one of the following:
- Corrupted Email Data: The problem is most prevalent when trying to resend emails that originally failed, particularly those with attachments. The data stored for the failed email may be incomplete or corrupted, which causes the resend process to fail when it tries to process this data.
- Plugin or Theme Conflict: Another plugin or your theme might be interfering with the JavaScript or AJAX requests that FluentSMTP uses to communicate with your server when resending emails.
- Cached Outdated Credentials: If you recently changed your SMTP credentials (e.g., API key, password), some parts of the plugin might still be referencing the old, invalid credentials, causing a conflict during the resend process.
- PHP Version Incompatibility: The specific PHP fatal error related to
preg_match()often indicates a deeper compatibility issue, frequently encountered when the plugin tries to handle attachment file paths that are not in the expected string format.
How to Fix It
Here are the most effective troubleshooting steps, compiled from successful community resolutions.
1. Update Everything
First, ensure your site's software is up to date. An outdated plugin or WordPress core is a common source of bugs.
- Update FluentSMTP to the latest available version.
- Update WordPress to the latest version.
- Update your theme and all other plugins.
2. Clear All Caches
Caching can sometimes serve old, broken JavaScript files or retain outdated data.
- Clear your browser cache and cookies.
- Clear any server-side or WordPress caching (e.g., from plugins like WP Rocket, W3 Total Cache, or your hosting provider's dashboard).
3. Check for Conflicts (The Most Common Fix)
A plugin or theme conflict is a very frequent cause of AJAX and JavaScript errors.
- Temporarily switch your theme to a default WordPress theme like Twenty Twenty-Four.
- Deactivate all plugins except FluentSMTP.
- Test if you can now resend a failed email.
- If it works, reactivate your plugins one-by-one, testing after each one, to identify the conflicting software.
4. Re-Authenticate Your Email Connection
If your mail service credentials recently changed, a deeper configuration cache might be causing issues.
- Go to FluentSMTP → Settings → Email Settings.
- For your primary connection, click Re-Authenticate or Update Settings.
- Re-enter your API key or SMTP password and save the settings.
- Run a Test Email to confirm the connection is working.
- Attempt to resend a failed email again.
5. For the Specific "preg_match()" Fatal Error
This error strongly suggests an issue with how email attachments are being handled during the resend process. The FluentSMTP team has acknowledged this bug in the past, and it is often fixed in subsequent updates. If you are on the latest version and still see this error, the most reliable workaround is to:
- Manually resend the information: Since the original email with its attachment cannot be resent through the log, look at the failed log entry to see who it was meant for and what the subject was, and then manually send a new email with the same content and attachment.
Preventing Future Issues
- Monitor Your Logs: Regularly check the FluentSMTP email log to catch failures early, before they pile up.
- Set Up Notifications: Configure the Telegram or email notification feature within FluentSMTP to alert you immediately when an email fails to send. This is crucial, as you may not receive these alerts if your email service is down.
- Keep Credentials Updated: If you change your email service password or API key, update it in FluentSMTP immediately.
If you continue to experience issues after trying these steps, it is recommended to seek help from the wider community by providing specific details about your error messages, PHP version, and the steps you've already tried.
Related Support Threads Support
-
No operation page displayedhttps://wordpress.org/support/topic/no-operation-page-displayed/
-
Elastic not attaching emails againhttps://wordpress.org/support/topic/elastic-not-attaching-emails-again/
-
Can’t resend the mail with attachmenthttps://wordpress.org/support/topic/cant-resend-the-mail-with-attachment/
-
Sparkpost: ‘json_array’, needs to ‘json_object’https://wordpress.org/support/topic/sparkpost-json_array-needs-to-json_object/
-
Accept numeric input only in port fieldhttps://wordpress.org/support/topic/accept-numeric-input-only-in-port-field/
-
All the emails are failed to sendhttps://wordpress.org/support/topic/all-the-emails-are-failed-to-send/
-
Mailgun Errorhttps://wordpress.org/support/topic/mailgun-error-3/
-
Fatal Error Resending Failed Emailhttps://wordpress.org/support/topic/fatal-error-resending-failed-email/
-
Logging doesn’t workhttps://wordpress.org/support/topic/logging-doesnt-work/
-
“Forgot Password” Message Not Sendinghttps://wordpress.org/support/topic/forgot-password-message-not-sending/
-
Impossible to resend mails – JS errorhttps://wordpress.org/support/topic/impossible-to-resend-mails-js-error/
-
Javascript error when retrying failed messageshttps://wordpress.org/support/topic/javascript-error-when-retryingfailed-messages/
-
Uncaught TypeError: Cannot read properties of undefined (reading ‘data’)https://wordpress.org/support/topic/uncaught-typeerror-cannot-read-properties-of-undefined-reading-data/
-
Someone spamming my website nameshttps://wordpress.org/support/topic/someone-spamming-my-website-names/
-
Not receiving contact forms OR failure noticeshttps://wordpress.org/support/topic/not-receiving-contact-forms-or-failure-notices/
-
Failed to Send Error Messagehttps://wordpress.org/support/topic/failed-to-send-error-message-2/
-
JS issue with sendinghttps://wordpress.org/support/topic/js-issue-with-sending/
-
422 error emails not senthttps://wordpress.org/support/topic/422-error-emails-not-sent/
-
The BanglaVoicehttps://wordpress.org/support/topic/the-banglavoice/
-
Failed Filter not workinghttps://wordpress.org/support/topic/failed-filter-not-working/
-
Errors sending emails in this week – “code”: 422https://wordpress.org/support/topic/errors-sending-emails-in-this-week-code-422/
-
Retry leads to errorhttps://wordpress.org/support/topic/retry-leads-to-error/
-
“Email failed” link in Dashboard not jumping to filtered viewhttps://wordpress.org/support/topic/email-failed-link-in-dashboard-not-jumping-to-filtered-view/
-
Telegram bot uses wrong domain after migration from Live to Devhttps://wordpress.org/support/topic/telegram-bot-uses-wrong-domain-after-migration-from-live-to-dev/
-
Plugin cache issuehttps://wordpress.org/support/topic/plugin-cache-issue-2/
-
Resend email feature seems broken (sends raw HTML)https://wordpress.org/support/topic/resent-email-feature-seems-broken-sends-raw-html/
-
Using the Github repo to submit issueshttps://wordpress.org/support/topic/using-the-github-repo-to-submit-issues/
-
Cannot resend failed emails after a certain date, ajax errorhttps://wordpress.org/support/topic/cannot-resend-failed-emails-after-a-certain-date-ajax-error/
-
JS file requested which does not existhttps://wordpress.org/support/topic/js-file-requested-which-does-not-exist/
-
Doesn’t work with BP GES?https://wordpress.org/support/topic/doesnt-work-with-bp-ges/
-
Random Failed emailshttps://wordpress.org/support/topic/random-failed-emails/
-
Not Receiving Emails as of last week – HELP!https://wordpress.org/support/topic/not-receiving-emails-as-of-last-week-help/
-
new from message e-mails sent twicehttps://wordpress.org/support/topic/new-from-message-e-mails-sent-twice/
-
Console error when resending failed emailshttps://wordpress.org/support/topic/console-error-when-resending-failed-emails/
-
Enabling Slack Error Notification – “Something went wrong”https://wordpress.org/support/topic/enabling-slack-error-notification-something-went-wrong/
-
PHP Fatal error: Uncaught TypeError: preg_match()https://wordpress.org/support/topic/php-fatal-error-uncaught-typeerror-preg_match/
-
Resend not resendinghttps://wordpress.org/support/topic/resend-not-resending/
-
JS error in console when trying to send a testhttps://wordpress.org/support/topic/js-error-in-console-when-trying-to-send-a-test/
-
Name of the website in the subjecthttps://wordpress.org/support/topic/name-of-the-website-in-the-subject/
-
SparkPost error when sendinghttps://wordpress.org/support/topic/sparkpost-error-when-sending/
-
Scrolling after submissionhttps://wordpress.org/support/topic/scrolling-after-submission/
-
Changes cannot be made at fsmpt_email_logs with Better Search Replacehttps://wordpress.org/support/topic/changes-cannot-be-made-at-fsmpt_email_logs-with-better-search-replace/