I'm building a contactform that needs to send all queries to the admin mail adress.
The php file which processes the entered data and sends the email has only contains this code:
<?php
$admin_email = get_option('admin_email');
if($_POST["name"] != "" && $_POST["contact"] != "" && $_POST["comments"] != "")
{
echo "Uw bericht is verzonden! ";
$name = $_POST["name"];
$contactOption = $_POST["contactoption"];
$msg = "Bericht afkomstig van: \n";
$msg .= "Naam: " .$name;
$msg .= "\nE-mail of Telefoonnummer: " .$contactOption;
$msg .= "\n\n";
$msg .= "Bericht: \n";
$msg .= $_POST["comments"];
$msg .= "\n\n";
$subject = utf8_decode("Bericht via Contactformulier");
$headers = utf8_decode("From: " .$name."\r\n");
mail($mailTo, $subject, utf8_decode($msg), $headers);
}
?>
The problem is, I cannot use get_option or get_bloginfo to get the admin mail adress. This allways returns a fatal error.
This file resists in my childtheme folder. Why can't I use these functions? I've also tried adding get_header() and get_footer() to the file, but these functions are also not recognized.
I'm relatively new to wordpress. Am I missing something obvious here?