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

时间:2017-07-26 21:21:58

标签: php notifications prestashop

我使用Mail::Send()函数发送电子邮件,但它不起作用,为什么?

文件/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 = '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');
    }
}

如何向我发送电子邮件?

1 个答案:

答案 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