我想使用 Mail::send 功能在订单确认时发送电子邮件?
I want to use Mail::send functionality for sending email on order confirmation?
我想使用 mail::send() 在下订单时向管理员发送通知 prestashop.My 邮件正在为客户工作,但我也想向商店管理员发送有关订单的邮件placement.And 还有一件事我不想为此使用任何单独的插件,我有我的支付模块,其中在放置 order.So 后最终订单状态发生变化,我只需要使用 Mail::send() 在该文件中以便发送通知。
Mail::Send(
(int)$order->id_lang,
'order_conf',
Mail::l('Order confirmation', (int)$order->id_lang),
$data,
$this->context->customer->email,
$this->context->customer->firstname.' '.$this->context->customer->lastname,
null,
null,
$file_attachement,
null, _PS_MAIL_DIR_, false, (int)$order->id_shop
);
像这样的东西需要实现,但这不能直接工作。
欢迎所有建议。
提前致谢。
Send是Mail的一个静态函数,你可以在PrestaShop项目的任何地方使用它。
使用示例如下:
$context = Context::getContext();
$id_shop = (int)$context->shop->id;
$id_lang = (int)$context->language->id;
$configuration = Configuration::getMultiple(
array(
'MA_LAST_QTIES',
'PS_STOCK_MANAGEMENT',
'PS_SHOP_EMAIL',
'PS_SHOP_NAME'
), null, null, $id_shop
);
Mail::Send(
$id_lang,
'checker',
Mail::l('Ordini', $id_lang),
array('template_vars'=>$vars),
$dest_mail,
null,
(string)$configuration['PS_SHOP_EMAIL'],
(string)$configuration['PS_SHOP_NAME'],
null,
null,
dirname(__FILE__).'/mails/',
false,
$id_shop
);
这个模型我用过。如果这里有疑问
在您的示例代码中,您向客户而不是商店管理员发送了电子邮件。您应该这样更改它:
Mail::Send(
(int)$order->id_lang,
'order_conf',
Mail::l('Order confirmation', (int)$order->id_lang),
$data,
Configuration:get('PS_SHOP_EMAIL')/*or directly desired email address*/,
'',
null,
null,
$file_attachement,
null, _PS_MAIL_DIR_, false, (int)$order->id_shop
);
您也可以使用邮件提醒模块来实现此功能。
祝你好运。
class sendEmail extends MailCore {
public function mailSend($data, $language){
if($language == 'en'){
$toSendLang = "new_order_en";
}else {
$toSendLang = "new_order_nl";
}
$shop_email = strval(Configuration::get('PS_SHOP_EMAIL'));
Mail::Send(
$data['mailIdLang'],
$toSendLang,
Mail::l('Order confirmation', $data['mailIdLang']),
$data['templateVars'],
$shop_email,
''.' '.'',
null,
null,
null,
null, dirname(__FILE__).'/mails/', false, $data['idShop']
);
}
}
伙计们,这是我用来向管理员发送电子邮件的 class,当然 works.You 只需为此 class 创建一个对象并使用 it.If 任何人对此有任何疑问,他们可以向 me.If 询问任何发现此答案有用的人,只需给出 upvote.Thanks 以提供建议。
我想使用 mail::send() 在下订单时向管理员发送通知 prestashop.My 邮件正在为客户工作,但我也想向商店管理员发送有关订单的邮件placement.And 还有一件事我不想为此使用任何单独的插件,我有我的支付模块,其中在放置 order.So 后最终订单状态发生变化,我只需要使用 Mail::send() 在该文件中以便发送通知。
Mail::Send(
(int)$order->id_lang,
'order_conf',
Mail::l('Order confirmation', (int)$order->id_lang),
$data,
$this->context->customer->email,
$this->context->customer->firstname.' '.$this->context->customer->lastname,
null,
null,
$file_attachement,
null, _PS_MAIL_DIR_, false, (int)$order->id_shop
);
像这样的东西需要实现,但这不能直接工作。 欢迎所有建议。 提前致谢。
Send是Mail的一个静态函数,你可以在PrestaShop项目的任何地方使用它。 使用示例如下:
$context = Context::getContext();
$id_shop = (int)$context->shop->id;
$id_lang = (int)$context->language->id;
$configuration = Configuration::getMultiple(
array(
'MA_LAST_QTIES',
'PS_STOCK_MANAGEMENT',
'PS_SHOP_EMAIL',
'PS_SHOP_NAME'
), null, null, $id_shop
);
Mail::Send(
$id_lang,
'checker',
Mail::l('Ordini', $id_lang),
array('template_vars'=>$vars),
$dest_mail,
null,
(string)$configuration['PS_SHOP_EMAIL'],
(string)$configuration['PS_SHOP_NAME'],
null,
null,
dirname(__FILE__).'/mails/',
false,
$id_shop
);
这个模型我用过。如果这里有疑问
在您的示例代码中,您向客户而不是商店管理员发送了电子邮件。您应该这样更改它:
Mail::Send(
(int)$order->id_lang,
'order_conf',
Mail::l('Order confirmation', (int)$order->id_lang),
$data,
Configuration:get('PS_SHOP_EMAIL')/*or directly desired email address*/,
'',
null,
null,
$file_attachement,
null, _PS_MAIL_DIR_, false, (int)$order->id_shop
);
您也可以使用邮件提醒模块来实现此功能。
祝你好运。
class sendEmail extends MailCore {
public function mailSend($data, $language){
if($language == 'en'){
$toSendLang = "new_order_en";
}else {
$toSendLang = "new_order_nl";
}
$shop_email = strval(Configuration::get('PS_SHOP_EMAIL'));
Mail::Send(
$data['mailIdLang'],
$toSendLang,
Mail::l('Order confirmation', $data['mailIdLang']),
$data['templateVars'],
$shop_email,
''.' '.'',
null,
null,
null,
null, dirname(__FILE__).'/mails/', false, $data['idShop']
);
}
}
伙计们,这是我用来向管理员发送电子邮件的 class,当然 works.You 只需为此 class 创建一个对象并使用 it.If 任何人对此有任何疑问,他们可以向 me.If 询问任何发现此答案有用的人,只需给出 upvote.Thanks 以提供建议。