2017-07-26 76 views
0

我已經使用Mail::Send()函數發送郵件,但它不起作用,爲什麼?Prestashop - 如何在客戶訂閱缺貨產品時發送電子郵件通知?

文件/mailalerts/controllers/front/actions.php: https://github.com/PrestaShop/mailalerts/blob/master/controllers/front/actions.php

processAdd()功能,if ($mail_alert->add() !== false)之前我已經加入這個:

if ($mail_alert->add() !== false) { 
     die('1'); 

      $product_name = Product::getProductName($id_customer); 
      $shop_email = '[email protected]'; 
      $shop_name = Configuration::get('PS_SHOP_NAME'); 
      $dir_mail = dirname(__FILE__).'/../../mails/'; 
      $template_vars = array(
       '{customer_email}' => $customer_email, 
       '{product_name}' => $product_name 
      ); 

      Mail::Send(
       $id_lang, 
       'new_oos', 
       Mail::l('New request of product', $id_lang), 
       $template_vars, 
       (string)$shop_email, 
       null, 
       (string)$shop_email, 
       (string)Configuration::get('PS_SHOP_NAME', null, null, $id_shop), 
       null, 
       null, 
       $dir_mail, 
       false, 
       $id_shop 
      ); 

    } else { 
     die('0'); 
    } 
} 

如何發送電子郵件給我?

回答

0

我想你還沒有在你的prestashop中配置郵件設置。 要從Prestashop發送電子郵件,您必須通過單擊高級首選項 - >電子郵件來配置SMTP。

的表格將是開放的,你必須輸入:

Server: smtp.gmail.com (if you uses gmail) 

Username: your gmail id 

Password: your gmail password 

Encryption: SSL 

Port: 465 
+0

郵件設置配置。這不是問題。 P.S:將電子郵件模板(new_oos.html和new_oos.txt)添加到mailalerts/mails/en /文件夾中。 – tRACE

+0

然後,你可以在ActionProductUpdate鉤子函數中定義你的代碼。 – MAC

+0

我不明白。爲了什麼?以及如何做到這一點? – tRACE

相關問題