向用户发送重复电子邮件的方式?

时间:2012-03-27 11:17:05

标签: php wordpress

我在wordpress中制作了简单的电子邮件,但它只会向管理员电子邮件发送电子邮件。我需要找到发送重复电子邮件的方式,感谢用户。

    $emailTo = get_option('tz_email');
    if (!isset($emailTo) || ($emailTo == '') ){
        $emailTo = get_option('admin_email');
    }
    $subject = 'I Have A Question to Ask from '.$name;
    $body = "Name: $name \n\nEmail: $email \n\nPhone: $phone \n\nComments: $comments";
    $headers = 'From: '.$name.' ' . "\r\n" . 'Reply-To: ' . $email;


    wp_mail($emailTo, $subject, $body, $headers);
    $emailSent = true;

    }

洞察力表示赞赏。谢谢。

2 个答案:

答案 0 :(得分:1)

看起来您已经拥有$email中用户的电子邮件地址,对吗?你在问题中显示的信息中使用了它。

$subject = '(duplicate) I Have A Question to Ask from '.$name;
$body = "This message was sent to the administrator:\n\nName: $name \n\nEmail: $email \n\nPhone: $phone \n\nComments: $comments";
$headers = 'From: '.$name.' ' . "\r\n" . 'Reply-To: ' . $email;
wp_mail($email, $subject, $body, $headers);

答案 1 :(得分:1)

只需添加:

wp_mail($email, "Thank you for your message", $body, $headers);