Jerir90 Posted August 29, 2019 Share Posted August 29, 2019 I'm using Prestashop 1.7.6.0 on a new site that I'm developing and I have a problem that on all emails, none of the placeholders are replaced with their values. So for example the Password Query email arrives looking as follows. Hi {firstname} {lastname}, Confirmation of password request on {shop_name} You have requested to reset your {shop_name} login details. Please note that this will change your current password. In order to confirm this action, click on the following link: {url} There are no errors shown when an email is sent, and nothing is added to the php error log. I'm using a custom theme, but I have the same problem if I revert back to the Classic theme. I started the development using Prestashop 1.7.4 but have recently upgraded to 1.7.6.0. I didn't test sending emails on the earlier versions so can't say if they worked before the upgrade. There have been no changes made to the Mail.php class and there is no override of that class either. Anyone got any ideas? Thanks Link to comment Share on other sites More sharing options...
Jerir90 Posted August 30, 2019 Author Share Posted August 30, 2019 Some extra information. I've now made a clean install of PS 1.7.6.1 with no custom theme or any additional modules, and that has the same problem. I'm installing it locally using Wamp as my web server, but the problem persists when I upload the site to my web hosting. I also have another website that uses PS 1.5.6 installed locally, and that has no such problems. Is there any additional setup required for emails on PS 1.7? Does anyone have any suggestions? Link to comment Share on other sites More sharing options...
Jerir90 Posted August 30, 2019 Author Share Posted August 30, 2019 Finally figured out what's happening. In Mail.php, the Replacements array is specified with a key of the 'To' address. However, the 'To' address on the email is modified by the toPunycode() function. If this changes the case of the characters in the 'To' address, then it will no longer find a match in the Replacements array and so will not update the placeholders. I've amended Mail.php so that when $toPlugin is set, it is set to self::toPunyCode() Note sure why nobody else seems to have this issue. Link to comment Share on other sites More sharing options...
jcata Posted November 28, 2019 Share Posted November 28, 2019 (edited) Hi I have the same trouble.. can you paste the Mail.php that you update ? thanks a lot Edited November 28, 2019 by jcata (see edit history) Link to comment Share on other sites More sharing options...
jcata Posted November 28, 2019 Share Posted November 28, 2019 Hi Again I solved it The trouble is when user set email in UPPERCASE like EMAIL@GMAIL.COM , I create a override/classes/Mail.php with code class Mail extends MailCore { public static function send( $idLang, $template, $subject, $templateVars, $to, $toName = null, $from = null, $fromName = null, $fileAttachment = null, $mode_smtp = null, $templatePath = _PS_MAIL_DIR_, $die = false, $idShop = null, $bcc = null, $replyTo = null, $replyToName = null ) { $to = strtolower($to); return parent::Send($idLang, $template, $subject, $templateVars, $to, $toName, $from, $fromName, $fileAttachment, $mode_smtp, $templatePath, $die, $idShop, $bcc, $replyTo); } } and now it works ok thanks a lot Link to comment Share on other sites More sharing options...
Oznerologos Posted February 28, 2020 Share Posted February 28, 2020 On 11/28/2019 at 6:40 PM, jcata said: Hi Again I solved it The trouble is when user set email in UPPERCASE like EMAIL@GMAIL.COM , I create a override/classes/Mail.php with code class Mail extends MailCore { public static function send( $idLang, $template, $subject, $templateVars, $to, $toName = null, $from = null, $fromName = null, $fileAttachment = null, $mode_smtp = null, $templatePath = _PS_MAIL_DIR_, $die = false, $idShop = null, $bcc = null, $replyTo = null, $replyToName = null ) { $to = strtolower($to); return parent::Send($idLang, $template, $subject, $templateVars, $to, $toName, $from, $fromName, $fileAttachment, $mode_smtp, $templatePath, $die, $idShop, $bcc, $replyTo); } } and now it works ok thanks a lot Expand Hello, I'm experiencing the same issue : customers with uppercase chars in their email address do not get a proper confirmation mail. I tried creating a new class in the override/classes folder like you did but the issue is still here... Any idea how to fix this ? Thanks ! Link to comment Share on other sites More sharing options...
Oznerologos Posted February 28, 2020 Share Posted February 28, 2020 Well, Instead of creating an override file, i edited the Classes/Mail.php with some strtolower() and it appears to be working. Nonetheless, thanks for the 1st idea ! Link to comment Share on other sites More sharing options...
jcata Posted February 28, 2020 Share Posted February 28, 2020 Hi , the trouble editing Classes/Mail.php is if you update prestashop these change can override .. then the best solutions is create a override/classes/Mail.php overriding default behavior.. greetings Link to comment Share on other sites More sharing options...
Oznerologos Posted February 28, 2020 Share Posted February 28, 2020 On 2/28/2020 at 2:52 PM, jcata said: Hi , the trouble editing Classes/Mail.php is if you update prestashop these change can override .. then the best solutions is create a override/classes/Mail.php overriding default behavior.. greetings Expand Yes, that's what i was thinking. Thing is, as I mentioned above, I tried to override with override/classes/Mail.php . I copied/pasted what you did but for some reason, it didn't work. If you have any idea why, I'm open to suggestions as i'd rather not edit the Classes/Mail.php ahah Thanks Link to comment Share on other sites More sharing options...
jcata Posted February 28, 2020 Share Posted February 28, 2020 Hi I've attach me Mail.php override I hope it solve your trouble... Mail.phpFetching info... Link to comment Share on other sites More sharing options...
Oznerologos Posted February 28, 2020 Share Posted February 28, 2020 (edited) Well, unfortunatly, even with your file, it didn't work... Guess I'll write a sticky note with "check Classes/Mail.php after every updates" ahah Anyways, thanks a lot, you still gave me a solution ! Edited February 28, 2020 by Oznerologos (see edit history) Link to comment Share on other sites More sharing options...
Jerir90 Posted February 28, 2020 Author Share Posted February 28, 2020 After creating a new override, you need to delete the class_index.php file (var\cache\prod) so that Prestashop will re-create it with details of the new file. Have you done that? Link to comment Share on other sites More sharing options...
Oznerologos Posted March 4, 2020 Share Posted March 4, 2020 On 2/28/2020 at 4:18 PM, Jerir90 said: After creating a new override, you need to delete the class_index.php file (var\cache\prod) so that Prestashop will re-create it with details of the new file. Have you done that? Expand Thanks for this, as you guessed, I didn't delete this file the 1st time I tried. I just did and it still doesn't work. I looked into the file after Prestashop re-created it and I found this : array ( 'path' => 'override/classes/Mail.php', 'type' => 'class', 'override' => false, ), Should I change 'override' to true ? Thing is, my solution (add strtolover() in the main Mail.php) works on my TEST website but not of my PROD website (TEST being a replica of PROD that customers can't reach) which i can't explain either... Do you guys have any idea ? Thanks ! Link to comment Share on other sites More sharing options...
jcata Posted March 4, 2020 Share Posted March 4, 2020 I don't know whats happen... Have you tried to delete cache ? Link to comment Share on other sites More sharing options...
Oznerologos Posted March 4, 2020 Share Posted March 4, 2020 Yes, I just deleted it again, still doesn't work Link to comment Share on other sites More sharing options...
kdmonk1 Posted April 7, 2020 Share Posted April 7, 2020 (edited) Did some digging and found out this occurs when a customer types their email address in caps: (ie: JOHN_DOE@GMAIL.COM). Here is the ticket and the fix for it. I hopes this helps someone else. https://github.com/PrestaShop/PrestaShop/issues/13386 Edited April 7, 2020 by kdmonk1 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now