gpt4 book ai didi

php - 在所有 Woocommerce 电子邮件通知中更改 "reply to"电子邮件地址

转载 作者:行者123 更新时间:2023-12-04 14:47:41 25 4
gpt4 key购买 nike

在 Woocommerce 中,我想更改应始终用作 的电子邮件地址。回复地址对于所有电子邮件通知。

Woocommerce 怎么可能做到这一点?

最佳答案

以下内容将更改所有电子邮件通知中的“回复”电子邮件地址(和姓名):

add_filter( 'woocommerce_email_headers', 'change_reply_to_email_address', 10, 3 );
function change_reply_to_email_address( $header, $email_id, $order ) {

// HERE below set the name and the email address
$reply_to_name = 'Jack Smith';
$reply_to_email = 'jack.smith@doamin.tld';

// Get the WC_Email instance Object
$email = new WC_Email($email_id);

$header = "Content-Type: " . $email->get_content_type() . "\r\n";
$header .= 'Reply-to: ' . $reply_to_name . ' <' . $reply_to_email . ">\r\n";

return $header;
}

此代码位于事件子主题(或主题)的 function.php 文件中。测试和工作(感谢 helgatheviking )。

相关: Custom "reply to" email header in Woocommerce New Order email notification

注意(更新):从 WooCommerce 3.7 开始, WC_Email实例对象现在作为第四个参数包含在钩子(Hook)中。

关于php - 在所有 Woocommerce 电子邮件通知中更改 "reply to"电子邮件地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55240846/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com