• I am trying to integrate a ‘subscribe to newsletter’ feature on my wordpress blog

    Users just need to enter their name and email address, hit subscribe. This is then supposed to send me an email and I add them to the mailing list.

    I activated the WP SMTP Mail plugin and entered in the relevant email server information to enable WordPress to send emails, asked WordPress to send me a test message and this worked.

    Now I want to receive an email whenever someone fills in their name & email and hit subscribe.

    If I do this at the moment it just takes me to newsletter_signup.php and I get at error message saying…

    ‘NOT FOUND Apologies, but no results were found for the requested post.’
    Obviously this is not right and no email is being sent/received.

    I have attached my code below, can anyone help me out here?

    Thanks

    Code for the signup form sidebar.php – This is not a plugin.

    <form action="newsletter_signup.php" method="post">
    <p><input class="full" type="text" name="fullname" placeholder="Your name*"></p>
       <p><input class="full" type="email" name="Email" placeholder="Your email                                    address*"></p>
    <p><input type="submit" class="sub-btn" value="Subscribe"></p>
                            </form>

    newsletter_signup.php

    <?php
    $fullname = $_POST['name'];
    $Email = $_POST['Email'];
    
    $to = 'me@myself.com';      
    
    wp_mail($to, $fullname, 'From: ' . $Email);
    echo 'Your request Has Been Sent, Thank You. ';
    
    ?>
Viewing 1 replies (of 1 total)
  • Where did you get that code for the form? This will not work inside the WordPress/Widget set up like you have.

Viewing 1 replies (of 1 total)

The topic ‘Using form method=post with wordpress’ is closed to new replies.