Sunday, April 14, 2013

Send Email in Prestashop

               How to send Email in Prestashop

               Its very simple just follow the following 2 steps

       Step : 1 You should create a email template html file with mail static contents

                     For Dynamic contents You must use {firstname} like this

                    Path for template html file : (root folder )mails/en/test.html

                    Inside the mails folder you will find many language files like en,fr,de,es,it

                    You can put the particular language file at inside particular folder


     Step : 2  Just use the following code to send mail at controller or wherever you want

                            $id_land = $order->id_lang;   // get current language id , if you are in order page you can use this

                           $template_name = 'test';  // this is file name here the file name is test.html                                           $title = "Test Login Details";    // mail title
                            $templateVars['{firstname}'] = "firstname"; 
                            $templateVars['{lastname}'] = 'lastname';
                            $templateVars['{email}'] = "email address";
                            $templateVars['{passwd}'] = "password";
                            $to = "testingto@gmail.com";
                            $toName = "To name";
                            $from = "testingfrom@gmail.com";
                            $fromName = "From Name";

                     
                           // mail function

   Mail::Send($id_land, $template_name, $title, $templateVars, $to, $toName, $from, $fromName);

                Enjoy ...............

1 comment: