mani313 Posted January 27, 2014 Share Posted January 27, 2014 (edited) hello there, i want to attach a file (example.jpg) in mailalerts module. i tried with following code. it does not work . please help me out with this. thanks in advance. #mailalerts.php line 386 if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/'.$template.'.txt') && file_exists(dirname(__FILE__).'/mails/'.$iso.'/'.$template.'.html')){ $template->attach(new Swift_Message_Attachment(file_get_contents("path/images/logo.png"), "logo.png", "image/png")); Mail::Send( $id_lang, $template, sprintf(Mail::l('New order - #%06d', $id_lang), $order->id), $template_vars, explode(self::__MA_MAIL_DELIMITOR__, $this->_merchant_mails), null, $configuration['PS_SHOP_EMAIL'], $configuration['PS_SHOP_NAME'], null, null, dirname(__FILE__).'/mails/' ); } Edited January 27, 2014 by mani313 (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted January 27, 2014 Share Posted January 27, 2014 Create $file_attachement: $file_attachement['content'] = your_binary_content; $file_attachement['name'] = your_filename; $file_attachement['mime'] = your_MIME; and put it at the Line 398. 2 Link to comment Share on other sites More sharing options...
mani313 Posted January 27, 2014 Author Share Posted January 27, 2014 hello sir, thanks for helping me out. our client little altered problem requirement again. now we only need to send copy of order confirmation email to printing company with one file attachment (ie sketch image). so as your suggestion i decide to use mail alerts module. though the problem minimized still its seems difficult. please mention where it gone wrong sir i tried your code. it outputs error : "The following e-mail template is missing: logo.pngen/new_order.txt " . please mention where it gone wrong sir . if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/'.$template.'.txt') && file_exists(dirname(__FILE__).'/mails/'.$iso.'/'.$template.'.html')) Mail::Send( $id_lang, $template, sprintf(Mail::l('New order - #%06d', $id_lang), $order->id), $template_vars, explode(self::__MA_MAIL_DELIMITOR__, $this->_merchant_mails), null, $configuration['PS_SHOP_EMAIL'], $configuration['PS_SHOP_NAME'], null, $file_attachement['content'] = file_get_contents("path/images/logo.png"), $file_attachement['name'] = "logo.png", $file_attachement['mime'] = "image/png", dirname(__FILE__).'/mails/' ); thanks in advance Link to comment Share on other sites More sharing options...
El Patron Posted January 27, 2014 Share Posted January 27, 2014 in regards to personal message for my review of this. I don't really get into development posts. My help here is more on how to use native ps. if you need more help and can not resolve here please post in paid jobs. maybe you click 'like' on tuk66 and he can help you more 1 Link to comment Share on other sites More sharing options...
mani313 Posted January 27, 2014 Author Share Posted January 27, 2014 yes i do, thanks for paying attention. 1 Link to comment Share on other sites More sharing options...
mani313 Posted January 27, 2014 Author Share Posted January 27, 2014 finally, i got solution i refered the forum http://www.prestashop.com/forums/topic/75045-attachments-to-e-mails/ and i used swift tool for mail alert module. i know its not good solution. i have no idea than this. my sincere thanks to tuk66 , scnd, rocky and patron. Link to comment Share on other sites More sharing options...
Recommended Posts