简体   繁体   English

Prestashop-当客户订购缺货产品时,如何发送电子邮件通知?

[英]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.

相关问题 产品有货时如何向客户发送通知 - how can i send a notification to customer when the product is back in stock Prestashop:如果产品缺货(允许订购),如何显示默认标签? - Prestashop:How to show a default label either if the product is in stock that out of stock (allowed to order)? 在无库存管理员通知中编辑产品链接 Email - Edit Product Link in No Stock Admin Notification Email 产品缺货后的 Woocommerce 电子邮件 - Woocommerce email after product is out of stock Prestashop:在目录价格规则中添加选项以选择库存产品或无库存 - Prestashop: Add option in Catalog Price Rules to select product in stock OR out of stock 在 WooCommerce 中添加产品超链接到低库存通知 email - Adding product hyperlink to low stock notification email in WooCommerce 购物车中的产品缺货时显示消息 - Show message when product in cart is out of stock 缺货时 Magento 捆绑产品价格 - Magento bundle product price when out of stock 使用 WooCommerce,我希望当客户点击产品价格中的“库存”并知道如何时隐藏/禁用产品属性“颜色部分” - using a WooCommerce,i wanted the product attribute "color section" to be hidden/disable when a customer clicked "stock" in product price and idk how 如何自定义 WooCommerce 无库存通知电子邮件 - How customize WooCommerce no stock notification email
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM