[英]Prestashop - How to sent email notification when customer subscribed to the out of stock product?
I have used Mail::Send()
function to send an email, but it does not work, why? 我已经使用
Mail::Send()
函数发送电子邮件,但是它不起作用,为什么?
File /mailalerts/controllers/front/actions.php: https://github.com/PrestaShop/mailalerts/blob/master/controllers/front/actions.php 文件/mailalerts/controllers/front/actions.php: https://github.com/PrestaShop/mailalerts/blob/master/controllers/front/actions.php
In processAdd()
function, before if ($mail_alert->add() !== false)
I have added this: 在
processAdd()
函数中,在if ($mail_alert->add() !== false)
我已经添加了以下内容:
if ($mail_alert->add() !== false) {
die('1');
$product_name = Product::getProductName($id_customer);
$shop_email = 'my-email-for-test@email.com';
$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');
}
}
How to send an email to me? 如何发送电子邮件给我?
I think you have not configured mail setting in your prestashop. 我认为您尚未在prestashop中配置邮件设置。 To send email from Prestashop, you have to configure SMTP by clicking on Advanced Preferences -> E-Mail.
要从Prestashop发送电子邮件,您必须通过单击高级首选项->电子邮件来配置SMTP。
A form will be open where you have to enter this : 将打开一个表格,您必须在其中输入以下内容:
Server: smtp.gmail.com (if you uses gmail)
Username: your gmail id
Password: your gmail password
Encryption: SSL
Port: 465
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.