Jump to content

Plain text in e-mails


Robert Surma

Recommended Posts

Hi,
I am using PrestaShop 1.7.6 and the format of my messages is set to plain text. Unfortunately, when I send a message to a client, it has elements of HTML code, for example:
 

Dear Customer, <br /> First line of text<br /> Second line of text <br /> Regards, <br /> <br /> - <br /> Robert <br /> Customer service <br />



When I set the format to "BOTH" - the HTML message is displayed correctly, but the plain text message still has HTML elements.

How to fix it?

Link to comment
Share on other sites

Open email template template-name.txt and delete <br />

Or open your email template in administration and translations and edit the txt version.

 

Link to comment
Share on other sites

Guest, thanks for your reply, but there are no HTML elements in my message template, just plain text.

I solved my problem in a strange and stupid way, but it works:
I changed the content of the nl2br function in the classes/Tools.php.

It was

public static function nl2br($str)
    {
        return str_replace(array("\r\n", "\r", "\n", AddressFormat::FORMAT_NEW_LINE, PHP_EOL), '<br />', $str);
    }


Now is
 

public static function nl2br($str)
    {
        return str_replace(array("\r\n", "\r", "\n", AddressFormat::FORMAT_NEW_LINE, PHP_EOL), "\n", $str);
    }

I suppose this problem can be solved in a better way, but I don't know how at this moment.

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...