如何在 "Note to customer" woocommerce 中更改 "From" 电子邮件地址

How to change "From" email address in "Note to customer" woocommerce

编辑订单时,管理员可以向客户发送消息。但是,wc-settings&tab=email 它使用“发件人”地址来发送邮件,例如:no-repy@gmail.com 我不想在“客户须知”中使用它。

我的意思是,使用“客户须知”功能将仅使用其他邮件,如 noteToCustomer@gmail.com。

add_filter( 'woocommerce_email_headers', 'change_reply_to_email', 10, 3 );
function change_reply_to_email( $header, $email_id, $order ) {
    $name  = 'Pickashirt';
    $email = 'noteToCustomer@gmail.com';
    if( $email_id == 'customer_note' ){
        $headers  .= 'From: ' . $name . ' ' . "<" . $email . ">";        
    }
    return $header;
}

希望能得到这方面的帮助。 非常感谢, 锡

以下将添加一个额外的回复电子邮件地址

add_filter( 'woocommerce_email_headers', 'change_reply_to_email', 10, 3 );
function change_reply_to_email( $header, $email_id, $order ) {
    $name  = 'Your Name';
    $email = 'notetocustomer@gmail.com';
    if( $email_id == 'customer_note' ){
        $header .= 'Reply-to: ' . $name . ' <' . $email . ">\r\n";
    }
    return $header;
}

更新

如果您需要更改发件人地址,则可以使用以下代码。

  add_filter( 'woocommerce_email_from_address', 'change_from_email', 10, 3 );
function change_from_email( $from, $email ) {
    if( $email->id == 'customer_note' ){
        $from = 'notetocustomer@gmail.com';
    }
    return $from;
}