Jump to content

Don't send any email or order confirmation to specific domain


Onno H

Recommended Posts

I have a question for a PHP developer. 

I would like to not send any email to any customer with a email address that ends with "bol.com"

At the moment orders from bol.com are imported to my store using a third party and the webservice api. Each customer gets a unique email address. For example "[email protected]". After the order is imported into Prestashop the order confirmation mail is automatically send. According to the rules of bol.com i am not allowed to send the customer more emails than necessary. So how can i block all outgoing email to this domain? 

I quess i have to add a rule to classes/Mail.php

I have tried it. But could not get it to work, because i am not a developer.

Could anyone help me? It would be very much appreciated.🙂 

Link to comment
Share on other sites

5 minutes ago, ComGrafPL said:

Have you tried set filter on your mailbox settings ( server side )?

I don't think i can. And if i could, i can't contact the customer by email if there is any problem with the order. 

Link to comment
Share on other sites

I found a way. 

For anyone who has the same problem and reads this later: 

Add this code to classes.mail.php (Prestashop 8, 😎 Change "bol.com" to the domain you do not want to send any email to)

        if (strripos($to,"bol.com")>0){
            self::dieOrLog($die, 'bol.com mail');

            return false;
        }

add it above this code: 

if (!is_array($to) && !Validate::isEmail($to)) {
            self::dieOrLog($die, 'Error: parameter "to" is corrupted');

            return false;
        }

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...