Fix Gmail SMTP in OpenCart (2025 Update)
When it comes to running an online store, it's vital that you have the ability to automatically reach out to customers for various reasons; order confirmations, customer signup approvals, order updates etc.
In the past, this has been very simple to do. You could use the built-in PHP Mail, not relying on a third-party email service and instead sending the email directly from the server.
Email Spam Problems
With the rise in email scams, phising and spoofing, email hosts have been increasing the security of inboxes - ensuring that spam is correctly identified and dealt with (sent to your Spam/Junk folder). This has caused a portion of the PHP Mail users to get flagged, especially if their website is hosted on a shared server (lots of sites resolve to one server IP) where someone could report the IP as sending spam.
Since then, a large portion of these PHP Mail OpenCart users have transferred to using the SMTP option in the store's settings. This means that you'll need to populate a couple more inputs (SMTP Hostname, SMTP Username, SMTP Password, SMTP Port, SMTP Timeout) with the trade-off that email deliverability increases.
This has worked for a good number of years without any issues. Since then, more and more users have needed to implement more robust DNS records (See our Emails Going to Spam in 2024: SPF, DKIM, and DMARC Explained blog regarding this) to decrease their spam score. These were all rather small fixes that took no longer than a few hours to get rectified.
Gmail SMTP Authentication Issue
Recently, however, we've had a few customers approach us this year noting that they're having issues with sending emails from their OpenCart store. We followed our usual process of testing their spam scores to find that the email never reaches the inbox at all.
Checking these client's setups, we found that these users were all using the Gmail SMTP service. After some serious debugging sessions, we always received the same error relating to an authentication issue.
After double-triple-checking the login details were all correct (using Google's App Password system), we uncovered that Google had finally sunsetted the use of third party software being able to use their Gmail SMTP using the App Password system.
This is actually a rather large problem; especially for stores running outdated OpenCart versions. There are little-to-no extensions readily available that use the Gmail API to send email instead.
The Solutions
For anyone using a, somewhat, updated OpenCart version, they can quickly find an extension available on the OpenCart Marketplace; I'd be a little wary though as this extension is "obfuscated" (meaning other developers cannot see/modify the code - leaving all support dedicated to the extension developer).
For others using an outdated version, you're left with one option: pay for a SMTP Relay Service.
Some SMTP Relays are free but their limits can be quite constricting, forcing you to pay for a larger package to accommodate all emails sent from your store.
In addition, it's not quite as simple as just "buy this package and all issues are resolved". You'll likely need to add additional DNS records for your domain to allow for them to send emails on your behalf and we've encountered that there are additional costs that may be needed to help keep your spam score down (i.e a dedicated IP with the service). With this in mind, here are a few businesses that offer a SMTP Relay that we have setup for clients in the past:
Your Thoughts
Please let us know in the comments below if you've been having the same issue, and how you went about fixing it. We want to hear your stories!
If you need some assistance with your email deliverability, feel free to reach out to us at info@antropy.co.uk.