How to fix “Error: RCPT TO not accepted from server!” Opencart error
Large store owners often set up their store with SMTP mail function to improve mail delivery rate and avoid spam problems.
This function works well in most sites, but sometimes, this can conflict with server configuration and results in an error.
“Error: RCPT TO not accepted from server! in system/library/mail.php” is one such reported issue by Opencart store owners when they send message from contact forms or feedback forms.
As a part of our Outsourced Technical Support for webhosts, we routinely resolve such errors faced by website owners.
Today, let’s discuss the top 2 causes for this error and how we fix it.
Reasons and Fixes for “error: rcpt to not accepted from server!”
Let’s see the top 2 reasons for this error.
1) Incorrect SMTP settings in Opencart
Store owners use SMTP feature to send emails, much like an email client. We have seen cases where incorrect settings like SMTP hostname, username, protocol or port can hinder the server from connecting to the SMTP server.
How to fix?
We verify the following SMTP settings in Opencart panel and confirm the connectivity to SMTP host using the telnet command.
Mail Protocol : SMTP SMTP Hostname : Address of SMTP host. Include the protocol also(ssl://smtp.gmail.com). SMTP Username : Email address of SMTP host. SMTP Password : Email account password. SMTP Port : The port number provided by SMTP host. SMTP Timeout : Timeout provided by SMTP host.
If we notice any issues, we quickly correct the SMTP settings.
2. Security restriction in servers
We see email providers use a security feature called SPF(Sender Policy Framework) to check the email authenticity of the sender.
It decides the servers that can send emails on behalf of a domain.
When emails don’t originate from the servers mentioned in the SPF record of the domain, mail server assumes it as fraud and rejects them.
As per Opencart algorithm, when client puts his contact email address(so that store owner can reply to him via this email) say email@example.com, Opencart system automatically assigns this email address as the FROM address of the message.
Consequently, the receiver end sees an email claiming to be FROM gmail.com, which is actually from a completely different server. Hence, it fails the SPF check process and mail bounces with the above error.
How to fix?
The right solution we suggest is to modify the Opencart contact form module.
It’s a quick fix as we need to edit a few lines. As a precaution, we always take a backup of the files before editing them.
1. Open the file catalog/controller/information/contact.php
2. Change the FROM field in the contact form to be same as store’s email address by modifying the line as below.
3. Change the Sender address as store’s email address by modifying the line as below.
4. Set the client’s email given in the contact form as Reply-to email by modifying the below line.
“Error: RCPT TO not accepted from server!” can occur due to incorrect SMTP settings in Opencart or security restrictions in the server. Today, we’ve seen how our Dedicated Support Engineers fix this issue.