I'm building custom contact form on wordpress using jquery $.post() function.
(tmlp_dir is theme directory path)
here is bugreport.php file:
I'm getting an error from wordpress that says: wp_mail() function not defined.
How can i let my php file use wp_mail() function?
Thanks.
Code:
$.post(tmpl_dir + '/bugreport.php',{ name:name, email:email, message:message }, function(data) {
if ( data ) alert( 'thanks for answer' )
else alert('error sending, please try again.');
})
(tmlp_dir is theme directory path)
here is bugreport.php file:
Code:
<?php
if ( isset($_POST['name']) && isset($_POST['email']) &&isset($_POST['message']) ) {
$name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message'];
$send_to = "[email protected]";
$subject = "Question from " . $name;
$success = wp_mail($send_to,$subject,$message);
if ($succsess) return true
else return false;
}
?>
I'm getting an error from wordpress that says: wp_mail() function not defined.
How can i let my php file use wp_mail() function?
Thanks.