使用带有附件的wc_mail

问题描述 投票:0回答:1

我有一个需要发送给第三方的自定义woocommerce电子邮件。在此电子邮件中,我必须添加附件。我尝试使用wc_mail(),但未附加附件。

这里是什么样子:

$attachment = array();
ob_start(); 
include('some-html-email-content.php');
$message = ob_get_clean();
$attachment[] = get_template_directory() . '/some.pdf';
wc_mail('[email protected]', 'some subject ', $message, "Content-Type: text/html\r\n", $attachment);

我可以收到电子邮件,没有任何问题,只有附件不存在。我做错了什么?

我无法使用woocommerce_email_attachments过滤器挂钩,因为此邮件未附加到任何常规woocommerce邮件(新订单,流程,新用户等...)。

我也尝试过wp_mail(),但仍然无法通过。

php email woocommerce email-attachments
1个回答
0
投票

这样的作品会吗?我认为您将值分配给数组变量的方式可能不正确?

$ attachment = array(get_template_directory()。'/some.pdf');

© www.soinside.com 2019 - 2024. All rights reserved.