如何在wordpress中使用wp_mail()函数

How to use wp_mail() function in wordpress

<?php
if (isset($_POST['sbt'])) {
//user posted variables
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];

//php mailer variables
  $to = get_option('aaaa@gmail.com');
  $subject = "Report";
  $headers = 'From: '. $email . "\r\n" .
    'Reply-To: ' . $email . "\r\n";

echo "check";

//Here put your Validation and send mail
$sent = wp_mail($to, $subject, strip_tags($message), $headers);
      if($sent) {
      echo "sent";
      }//mail sent!
      else  {
      echo "failed";
      }//message wasn't sent
}
?>

我开发了一个自己的文字新闻网站,我需要在我的联系表中使用 WP_mail() 功能。

请帮帮我

这是示例:

//user posted variables
  $name = $_POST['message_name'];
  $email = $_POST['message_email'];
  $message = $_POST['message_text'];

//php mailer variables
  $to = get_option('admin_email');
  $subject = "Some text in subject...";
  $headers = 'From: '. $email . "\r\n" .
    'Reply-To: ' . $email . "\r\n";
 }

//Here put your Validation and send mail
$sent = wp_mail($to, $subject, strip_tags($message), $headers);
      if($sent) {

      }//message sent!
      else  {

      }//message wasn't sent