Bobcares

Problems with your Prestashop emails? Here’s how to fix it

by | Nov 6, 2018

Prestashop owners prefer mail() over SMTP to send emails, because it’s so easy to use.

But, this can sometimes conflict with the server security settings and lead to errors.

If my Prestashop emails don’t work, how do I receive order confirmation emails or contact form emails?

That’s a common query we often resolve as part of our Technical Support Service for web hosting companies.

Today, let’s see the top 2 reasons for this error and how we fix it.

 

Prestashop emails not working – Top 2 reasons and solutions

Prestashop email errors can occur mainly due to the security restrictions in the server.

 

1. Disabled PHP mail() function

PHP mail() is an inherently vulnerable function. Hackers can exploit it and send spam.

To prevent this, some hosts may disable this mail() feature.

How we fix?

Our Support Engineers confirm whether the mail() function is disabled or not using a phpinfo page(<? phpinfo(); ?) in the website.

If this function is disabled, it will display under disable_functions list.

We then suggest the option to use SMTP function to send emails.

You can use the following SMTP settings in your Prestashop email configuration.

Mail domain name : Your store name.
SMTP server : Your SMTP server.
SMTP user : Your complete email account.
SMTP password : Your email account password.
Encryption : Either SSL or TLS encryption.
Port : SMTP server port.

 

2. Security restrictions in the server

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 Prestashop algorithm, when client puts his contact email address, say test@gmail.com, the 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 we fix?

The quick solution is to modify the Prestashop Swift Mailer module.

We need to modify 3 files here. But before that, we always take a backup of the files.

1) Open the file /tools/swift/Swift/Message.php and change the FROM field to be an email associated with your domain.

Change:

$this->setFrom("");

To

$this->setFrom("yourmailid@yourdomainname");

 

2) Open  /tools/swift/Swift.php and add client’s email given in the contact form as Reply-to email by modifying the below line.

Change:

if (!($has_reply_to = $message->getReplyTo())) $message->setReplyTo($from);

To:

if (!($has_reply_to = $message->getReplyTo())) $message->setReplyTo($from);
if (!$has_reply_to[0]) $message->setReplyTo($from->getAddress());

 

3) Open  /tools/swift/Swift/Plugin/MailSend.php to disable additional parameters in the message.

Change:

$headers = $headers->build();

To

$headers = $headers->build();
$params = "";

That’s it. Your Prestashop site should now be able to send emails.

 

Conclusion

Prestashop email errors can occur due to security restrictions in the server. “Sending failed using mail() as PHP’s default mail() function returned boolean FALSE” is one such error. Today, we’ve discussed the top 2 reasons for this error and how our Support Engineers fix them.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

3 Comments

  1. Rick

    Nice explanation. I think most of shop owners use some custom SMTP servers for sending emails.

    Reply
  2. B Miller

    If you self host from your residential ISP and they block port 25, does that make sendmail useless? I.E. can you even use it and if you change ports, won’t you never receive email? I tried SMPT through gmail and I get nothing but authentication errors, it can never make the login and pw work.

    Reply
    • Hiba Razak

      Hi,

      Our Experts can help you with the issue, we’ll be happy to talk to you on chat (click on the icon at right-bottom).

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF