<?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
}
?>Run Code Online (Sandbox Code Playgroud)
我已经开发了自己的文字出版网站,我需要在联系表单中使用WP_mail()函数。
请帮我。
wordpress wordpress-theming custom-wordpress-pages wordpress-thesis-theme