🚨 Fixing Joomla Email Error: “An error has occurred while fetching the JSON data: HTTP 504 Gateway Timeout”
when trying to send emails, don’t panic. This error simply means Joomla is trying to connect to your email server (SMTP) but the request is taking too long and eventually times out.
If you’re running a Joomla-powered website and encounter the error:
“An error has occurred while fetching the JSON data: HTTP 504 status code. Gateway Timeout”
when trying to send emails, don’t panic. This error simply means Joomla is trying to connect to your email server (SMTP) but the request is taking too long and eventually times out.
In this blog, we’ll break down the common causes of this error and provide step-by-step solutions to get your Joomla email system working again.
🔎 What Causes the 504 Gateway Timeout in Joomla Emails?
A 504 Gateway Timeout usually happens when:
- Joomla cannot reach the SMTP mail server.
- The mail server is too slow to respond.
- Your hosting provider blocks outgoing SMTP connections.
- Incorrect SMTP settings are used (wrong host, port, or security type).
- PHP/Apache timeouts are too short for the mail request.
âś… Step 1: Check Joomla Mail Settings
Log in to Joomla Admin → System → Global Configuration → Server → Mail Settings.
Confirm the following:
- Mailer: Use
SMTP(more reliable than PHP Mail). - SMTP Host: Example →
mail.yourdomain.com. - SMTP Port:
587(TLS) or465(SSL). - SMTP Authentication: Yes.
- SMTP Username/Password: Your email account credentials.
- SMTP Security: TLS or SSL (as required by your email provider).
👉 If you’re using Gmail, Outlook, or Zoho, you may need to generate an App Password or set up OAuth authentication.
âś… Step 2: Test the SMTP Connection
If emails still don’t send, test connectivity from your hosting server:
telnet smtp.yourmailserver.com 587
or
openssl s_client -connect smtp.yourmailserver.com:465
- If it connects successfully, Joomla should be able to send mail.
- If it hangs or times out, your server can’t reach the mail server (firewall, DNS issue, or blocked port).
âś… Step 3: Increase PHP Timeout
Sometimes the mail server is just too slow. To give Joomla more time:
Edit your php.ini or .htaccess file and add:
max_execution_time = 120
default_socket_timeout = 120
Then restart your server.
âś… Step 4: Check for Hosting Restrictions
Some shared hosting providers block SMTP ports (465/587) for security reasons.
If this is the case:
- Use your host’s local mail relay (localhost) instead of an external SMTP.
- Or switch to a reliable transactional mail service (SendGrid, Mailgun, Amazon SES).
âś… Step 5: Enable Debugging
Go to System → Global Configuration → System → Debug System (Enable).
Try sending a test email again, and check the logs under:
administrator/logs/error_logfrom your hosting panel
This will show exactly why Joomla is failing.
âś… Step 6: Use an Email Extension
If Joomla’s built-in mailer still gives you headaches, consider using a third-party extension like:
- AcyMailing
- SMTP Mailer
- Elastic Email plugin for Joomla
These tools are optimized for handling email and can bypass some of Joomla’s limitations.
🚀 Wrap Up
The HTTP 504 Gateway Timeout error in Joomla emails is frustrating, but the fix usually lies in:
- Correcting your SMTP settings,
- Ensuring your server can reach the mail host,
- Extending timeouts, and
- Using reliable email services.
By following the steps above, you’ll be able to restore smooth email delivery in Joomla and avoid missed messages.
👉 Pro tip: If you’re hosting your emails with Plesk or cPanel, always use your server’s mail domain (e.g., mail.yourdomain.com) with proper authentication instead of relying on PHP mail.