Opencart – fixing “Notice: Error: RCPT TO not accepted from server!” (VQMOD)

This is a patch to fix problems with sending contact form in Opencart 1.5 and 2.0.

If you get the following (or similar) message:

Notice: Error: RCPT TO not accepted from server! in system/library/mail.php on line 308

in your Opencart installation, be it v 1.5.x or 2.0.x, then probably your email provider has SPF policy (Sender Policy Framework) verifying the so-called FROM address. This is a good thing, it means that your email provider has a properly configured server that protects from spam messages and other improper uses.
With SPF policy, you cannot put anything you want in the FROM field, it needs to match your account address or at least your email domain.
In other words, if your email address for the shop is, let’s say, moc.niamodruoy@pohs, it will probably only allow moc.niamodruoy@pohs as a sender address or in the best case scenario moc.niamodruoy@GNIHTYNA.

Opencart Contact Form

The error listed above is caused by the fact that OpenCart for some reason is using another approach. In OpenCart solution, the email address that your client is putting in the contact form is automatically assigned by the OpenCart system as the FROM field of the message. It means that the contact form message is forcefully interpreted as a message coming from your client’s email account (which is not the case, your client is not sending this message from his email account, he only gives you his email address so that you can reply to him).This means that a properly configured server will not send such a message and your client will not be able to contact you.

So should you ask your email account provider to change this SPF or whatsoever setting so that you’re able to use OpenCart way of doing things?

Well, there is a slight problem with this solution. Most providers won’t change their SPF policy. And they are right. Their approach is 100% correct according to email configuration standards (see RFC 4408 http://www.ietf.org/rfc/rfc4408.txt ). It is also a good practice when fighting spammers.

That is the right solution, then?

The best thing to do is to modify your OpenCart emailing library to make it act properly :)

This is really easy as you only need to change just a few lines of code in 2 files.

If you don’t feel like doing it on your own, I have written simple vqmods that will do the same thing for you. If you don’t have Vqmod installed or you don’t want to install it just follow the steps in those two tutorials for OpenCart 1.5 and 2.x

***UPDATE 08-06-2015
Version 0.2.1 of our module released
– Fixed Reply-to bug when receiving new order alerts (Thanks to Fayez Saidawi for pointing this out)

***UPDATE 13-02-2015
Version 0.2 of our module released
– Added field in Mail tab that lets you configure smtp account for sending mails independently from your store main email
– All emails from contact forms and notifications will be send to main store email


You can download our mods here:

Opencart 1.5 – Contact form sending problems with smtp account fix
Opencart 2.0 – Contact form sending problems with smtp account fix

Installation

Unzip those files and copy them to vqmod/xml folder in your store main directory. Thats it!

Configuration

Those modules will use SMTP Email Address as the FROM field. So make sure that this field is the same as the account you set in email tab in your shop settings(just as on the picutre below).

The emails will be send to your main shop email (set in Email field in Store tab).

Opencart admin

If you have any problems with installing those modules or you need professional help with customizing your OpenCart

Contact us for a free consultation or quote

blog comments powered by Disqus