PHP E-Mail Form w/Options
I need to include the first co开发者_StackOverflow中文版de (which calls the e-mail from a WordPress options panel) in the second code where it says email@mail.com. I tried to include " around the code, but it doesn't seem to work. I also tried to strip slashes, but to no avail.
How I call the e-mail
<?php echo get_option('to_email'); ?>
The relevant part of my contact form:
if(!isset($hasError)) {
$emailTo = 'email@mail.com';
$subject = 'Contact Form Submission from '.$name;
$sendCopy = trim($_POST['sendCopy']);
$body = "Name: $name \n\nEmail: $email \n\nComments: $comments";
$headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
mail($emailTo, $subject, $body, $headers);
$emailTo = get_option('to_email');
You have to make sure the right files are included (wordpress config files).
精彩评论