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

标签 wordpress wordpress-theming custom-wordpress-pages wordpress-thesis-theme

关闭。这个问题需要更多focused .它目前不接受答案。












想改善这个问题吗?更新问题,使其仅关注一个问题 editing this post .

5年前关闭。




Improve this question




<?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

关于wordpress - 如何在wordpress中使用wp_mail()函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39890334/

相关文章:

javascript - 重定向到用户来自的页面

php - Ajax 更新 Woocommerce 中购物车菜单上的产品数量

php - Themosis 框架集合循环 - WordPress

windows - Google App Engine 部署的媒体错误

php - 从自定义帖子类型编辑屏幕中删除标题

css - 二十个子主题 - 修改主题宽度(940px 到 1000px)

PHP - 仅在主页上隐藏元素 - WordPress 网站

php - Wordpress 表单处理

javascript - 如何在 WordPress 中的文本输入输入字段中添加自动完成功能

Mysql 数据库未显示 localhost phpmyadmin (sequel pro)