邮件上的模板变量::发送PrestaShop

时间:2014-12-11 15:42:31

标签: php api email prestashop

我有此代码在通过Web服务添加客户时发送电子邮件

$data = array(
'{firstname}' => (string)$customer->firstname,
'{lastname}' => (string)$customer->lastname,
'{email}' => (string)$utilizador->Email,
'{passwd}' => (string)$utilizador->Password,
'{shop_name}' => 'BikeZone',
'{shop_url}' => 'http://maggpresta.atomsrv.com'
);

$dump = Mail::Send(2, 'account', 'Criação de conta de cliente', $data,
                   $utilizador->Email,   $customer->firstname.' '.$customer->lastname,
                   null, null, null, null,_PS_MAIL_DIR_, true, 1, false);

它正在发挥作用。电子邮件已发送,但模板变量全部为空,如此图片所示。

Prestashop empty template vars

有没有人遇到同样的问题?我该如何解决?

1 个答案:

答案 0 :(得分:2)

我很久以前遇到过这个函数的问题,但我找到了如何正确使用它:

https://www.prestashop.com/forums/topic/398911-solucionado-estructura-de-la-funci%C3%B3n-mailsend/

$ data数组的正确用法应该是:

  static boolean assertEquals(double d1, double d2) {
    return Math.abs(d1 - d2) < 1e-8;
}