Support » Plugins » Contact form – how to get subject line displayed in received e-mail

  • Hey there,

    Do you know how to get the subject line being displayed in the received message (subject is not required) I have this code in my contact page template:

     $error = "";
     $error .= "<p>Please enter your name</p>";
     $error .= "<p>Please enter a valid email address</p>";
     $error .= "<p>Please enter a message</p>";
     $email = wp_mail(get_option("admin_email"),trim($_POST[your_name])." sent a message from ".get_option("blogname"), stripslashes(trim($_POST[your_message])),"From: ".trim($_POST[your_name])." <".trim($_POST[your_email]).">\r\nReply-To:".trim($_POST[your_email]));

    and this is the form:

    ?php if($email){ ?>
     <p><strong>Message sent. Thank you.</strong></p>
     <?php } else { if($error) { ?>
     <p><strong>Your message has not been sent</strong><p>
     <?php echo $error; ?>
     <?php } else { the_content(); } ?>
     <form action="<?php the_permalink(); ?>" id="contact_me" method="post">
     <input type="hidden" name="sent" id="sent" value="1" />
     <div id="form">
     <div id="label">Name*</div>
     <div id="input-field"><input type="text" name="your_name" id="your_name" value="<?php echo $_POST[your_name];?>" /></div>
     <div id="label">e-mail*</div>
     <div id="input-field"><input type="text" name="your_email" id="your_email" value="<?php echo $_POST[your_email];?>" /></div>
     <div id="lebel">Subject</div>
     <div id="input-field"><input type="text" name="your_subject" id="your_subject" value="<?php echo $_POST[your_subject];?>" /></div>

    I would like to have the e-mails that I will received look something like

    [name] sent you a message from blog (as the header)

    (and message below)

  • The topic ‘Contact form – how to get subject line displayed in received e-mail’ is closed to new replies.