Skip to main content

Configure OpenCart to send notification emails & ensure they are not flagged as spam

By July 17, 2018May 2nd, 2023Blog
Configure Opencart Email

Help – OpenCart won’t send emails!

If you have an OpenCart website you need to configure the mail settings so that email notifications are sent to both the customer and administrator.

Recently I had issues with a clean install of OpenCart not sending notification emails and then secondly, when I finally got OpenCart to send emails (using the Mail option) to both admin and customer – my customers emails were going straight to the spam bin.

After hours of searching about on the internet I finally found a solution to both issues and in this article I am going to let you know how to fix both.

Configuration of OpenCart Mail settings

There are two ways you can configure OpenCarts Mail tab. You can use Mail or SMTP. The mail setting is the easiest to set up but NOT the best solution because this simply uses PHP mail to send system emails.

The problem of sending system emails via this method is that your email headers say the email is sent from the website hosting name instead of your actual domain name. This means that your website system emails are NOT verified and will most likely end up in your customers spam bin, especially if your customer is using Gmail or Hotmail.

As an example, if your website is on a Hostgator shared server the mail header would appear to be sent from something like instead of your domain name. The problem is that shared servers include other peoples websites, some of which may have sent spam, thus blacklisting the server IP as being noted for sending spam. This means your website’s OpenCart system emails will go straight to your customers spam bin. The best way to stop your OpenCart emails going to spam is to use SMTP instead of Mail – discussed further down. If you still want to use OpenCart Mail to send notification emails using PHP mail read on.

OpenCart Mail not sending notification emails using Mail Protocol

I had a new installation of OpenCart on website set up to use the Mail option on a shared server but no emails were being sent to either Admin or Customer.

The reason why OpenCart was not sending emails using the Mail option is because host Sendmail path was incorrect. This can be especially true on Hostgator servers. The instructions below explain how to get OpenCart to send email using the Mail tab.

If your website is on a shared server (not listed by Google for sending spam) and you want to use the Mail option you need to do the following to ensure system emails are sent to both Administrator and Customer.

Part 01 – Is your PHP Sendmail path correct on your website server?

Firstly create a file called phpinfo.php in Dreamweaver or Notepad. Copy the following lines into the document:


Save and upload the document to your server root directory. Open the file in a browser to view your system PHP information.

This will display your systems PHP version and settings.

Next, search the result for the term ‘Sendmail’.

If the Sendmail path says: -t -i your Opencart will NOT be able to send system notification emails using Mail because the path is incorrect. The correct path should be: sendmail_path = /usr/sbin/sendmail -t -i;

To fix the Sendmail path issue you can set the path manually in the local php.ini files in both the:

  1. Root directory (usually (public_html) of our site andin the
  2. Admin directory.

Just add the following line to the php.ini file as long as that is the real path to Sendmail on your server. (If you are not sure ask your hosting company).

sendmail_path = /usr/sbin/sendmail -t -i;

Part 02 – How to configure OpenCart Mail tab

Next you need to configure the Mail tab in openCart. Login to your OpenCart website and go to System / Settings / Mail.

For the Mail Parameters field you need to enter your Admin email with a prefix of -F. It’s important that the prefix uses uppercase.

Doing the above allows OpenCart Mail to start sending system notification emails to both Customers and Admin. If your websites shared server has NOT been noted for sending spam the above Mail configuration should work fine for you.

But, if your websites shared server has been noted for sending spam in the past your OpenCart notification emails will go straight to customers spam bins which not good.

Here’s the solution.

Help – My OpenCart emails are going straight to spam! Use SMTP instead of Mail to stop emails going to spam.

If your OpenCart notification emails are going straight to customers spam bins you need to use SMTP instead of Mail. In fact, after researching the differences between Mail & SMTP I’d recommend to use SMTP for all website system emails every time. This is because SMTP mail is sent and verified using a real email address rather than your websites PHP Sendmail which is often used by spammers.

To stop OpenCart notification emails going straight to spam you need to create an SPF Record and use SMTP instead of Mail.

Part 01 – Creating an SPF record

The problem using Mail is that it simply uses the PHP mail function on your website. Any website PHP mail can send mail for any sender email address which means spammers can pretend to be sending mail from sites that don’t belong to them. When this happens the server those sites are hosted on can be blacklisted for sending spam. If your site happens to be on such a host your OpenCart system emails will go straight to spam even though you have never sent any spam yourself.

The only way to fix this issue is by creating an SPF (Sender Framework Policy) record in your DNS settings. An SPF record verifies that mail sent is authentic and won’t be flagged as spam in a recipients inbox.

To create an SPF record you will need access to the domain DNS settings.

Create a new TXT record to verify which sources are legitimately allowed to originate email for your domain names.

To generate your SPF TXT record visit

If you are using Google Apps to send your website emails you can get the Google SPF settings here:

Once you have your SPF information you need to add this as a new TXT record to your domains DNS.

You may also need to ensure your that Email Authentication SPF is enabled in your Cpanel.

Note: If your websites DNS settings are managed by your domain registrar ask them to help you set an SPF record for you.

Part 02 – Configuring OpenCart SMTP Mail settings to send mail

Once you have your SPF Record in place you are ready to configure your OpenCart Mail SMTP settings. SMTP uses a real email address (no aliases) to send emails rather than using OpenCarts PHP mail Sendmail.

Using SMTP to send mail in conjunction with an SPF record will ensure your OpenCart website emails are verified, sent and do not end up in customers spam bins.

  • Login to your OpenCart website.
  • Go to and go to System / Settings / Mail.
  • You can obtain the correct SMTP settings for your email account from your sites Cpanel / Email Accounts / Configure Mail Client. Use recommended the SSL/TLS settings.

If you are using Google Apps MX Records for your SMTP mail apply following settings.
Mail Protocol: SMTP.
Mail Parameters: Leave blank.
SMTP Hostname:
SMTP Username: Your Google App email address. Example:
SMTP Password: The password for your email account.
SMTP Port: 465
SMTP Timeout: 5
Add any additional alert emails in the bottom text area separated by commas. Click the image below to see a larger view.

Make a test purchase using another Gmail account. Your OpenCart website will now send your customer notification emails and they should also land directly in their inbox instead of the spam bins.

Gsuite & Less Secure Apps

If you are using Gsuite for your website email, you will need to enable Less Secure Apps under your Gsuite account used to send the email. If don’t enable Less secure in your Google Apps Panel people who try to register at your website will see a warning that says something like:

Notice: Error: Password not accepted from server! in /home/yourwebsite/public_html/system/library/mail.php on line 289

To enable Less Secure Apps for your website do the following.
Login to your Gsuite Cpanel.
Go to Security / Basic Setting / Less Secure Apps
Go to settings for less secure apps
Enable for all and save changes.

Open up a new browser tab and search ‘less secure apps google’ or go to the following URL.

Click the link in step 2. “Less secure apps” section of MyAccount.
Ensure Access for less secure apps is Turned On.

Open a new private window and go to
Sign in
Search for less secure apps google or go to the following URL.
Ensure Access for less secure apps is Turned On.

Unlock Captcha

Finally, when logged into the Gsuite email account (used to send OpenCart emails), search unlockcaptcha google apps
Click Continue button

You should then see:
Account access enabled
Please try signing in to your Google account again from your new device or application.

Once you have done the above new customers can register without seeing any error messages.


To ensure that your OpenCart website notification emails are sent and delivered to customers inboxes you must:

  1. Use the SMTP method with a real email address (not an alias).
  2. Create a SPF record that states which machines can send mail for your domain.
  3. If using Google Apps for email you must enable Less Secure Apps and unlock captcha.


Join the discussion 5 Comments

  • John Grandshaw says:

    Thanks for the article Neil worked a treat for me using your instructions and the references. I’m not a web developer just a guy setting up an OpenCart webshop for myself. Really helped me get over the problem with the contact form not sending emails. Top man. JG

  • Herb Hammons says:

    Thank you VERY much for this article. I have been fighting the ‘no email’ issue for a week with no luck. I tried your fix for the Mail protocol and mail suddenly started flowing. Especially helpful was the note that said “This can be especially true on Hostgator servers” – because that’s precisely where my site is hosted.

    Thanks again, Neil, you’ve saved my sanity (what little I have left…) 🙂

    Best regards,

    • neilforrester says:

      Hi Herb,

      I’m glad my article has helped you. It’s the most visited page on my website! 🙂

      Kind regards,

  • Jennifer says:

    Thank you Neil!
    Your instructions are so so good!

    We suddenly had issues with New Order emails not being sent to customers and I was silently panicked as I’m not very cluey on how to fix things that go awry with our website (especially when I didn’t make any modifications to account for this change!)

    I used the SMTP solution and am very thankful you provided such clear and concise instructions to solve the issue. Thank you again!

    One edit I needed to make was adding SSL in front of the SMTP host.

    SMTP Host: ssl://

Leave a Reply