The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

contact form works in one theme, not in the other (1 post)

  1. do77
    Posted 3 years ago #

    Hi there,

    I hardcoded a contact form into my theme's sidebar and it works. Now I added the exact same code to another theme and it doesn't send the email. Any idea why?

    <?php global $current_user;
    //If the form is submitted
    if($_POST) {
    	$to = '### (Email deleted for purpose of posting)';
    	$subject = . $name . ' sent you a message!';
    	$message = $_POST['message'];
    	$name = $_POST['name'];
    	$from_email = $_POST['email'];
    	$headers = 'From: ' . $name . ' < ' . $from_email . ' >'; 
    	wp_mail( $to, $subject, $message, $headers );
    } ?>
    <form method="POST">
    <input type="hidden" name="name" id="name" value="<?php echo $current_user->display_name; ?>">
    <input type="hidden" name="email" id="email" value="<?php echo $current_user->user_email; ?>">
    <textarea name="message" id="message" rows='' cols='' placeholder="Your message..."></textarea>
    <input type="submit" name="submit" id="submit" value="Submit" />
    <div class="clear"></div>

Topic Closed

This topic has been closed to new replies.

About this Topic