【问题标题】:Set reply-to address in wp_mail header在 wp_mail 标头中设置回复地址
【发布时间】:2020-11-04 01:19:51
【问题描述】:

我使用 wp_mail 从我的 WordPress 主题中发送通知。如何在以下 wp_mail 脚本中添加回复地址:

$recipient  = "recipient@example.com";
$headers = array('Content-Type: text/html; charset=UTF-8','From: MyWebsite <'mywebsite@example.com'>');
$message = 'Here is the sent message';
        
wp_mail( $recipient, 'Here comes the Subject', $message, $headers );     

   

【问题讨论】:

    标签: wordpress email wp-mail


    【解决方案1】:

    您可以在$headers 数组中设置回复地址。它需要在 中包含电子邮件地址,我建议使用名称以确保一切正常。

    $headers[] = 'Reply-To: Firstname Lastname &lt;your@mail.com&gt;';

    我为您的电子邮件添加了一个主题。所以你的代码看起来像:

    $recipient  = "recipient@example.com";
    $subject = "Your subject";
    $message = "Here is the sent message";
    $headers = array(
        'Content-Type: text/html; charset=UTF-8',
        'From: MyWebsite <mywebsite@example.com>',
        'Reply-To: Firstname Lastname <your@mail.com>'
    );
    
    wp_mail( $recipient, $subject, $message, $headers );
    

    【讨论】:

    • 像魅力一样工作
    猜你喜欢
    • 1970-01-01
    • 2013-08-08
    • 1970-01-01
    • 1970-01-01
    • 2011-10-24
    • 1970-01-01
    • 1970-01-01
    • 2011-11-26
    • 1970-01-01
    相关资源
    最近更新 更多