<?php
if (isset($_POST['sbt'])) {
//user posted variables
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
//php mailer variables
$to = get_option('[email protected]');
$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
}
?>
I have developed a own word press site i need to use WP_mail() function to my contact form.
please help me.
this is example:
//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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With