I’m attempting to combine a ‘subscribe to newsletter’ function on my wordpress weblog
Customers simply must enter their title and e-mail deal with, hit subscribe. That is then speculated to ship me an e-mail and I add them to the mailing checklist.
I activated the WP SMTP Mail plugin and entered within the related e-mail server data to allow WordPress to ship emails, requested WordPress to ship me a take a look at message and this labored.
Now I need to obtain an e-mail each time somebody fills of their title & e-mail and hit subscribe.
If I do that in the intervening time it simply does nothing, it re-loads the web page with out sending an e-mail.
I’ve hooked up my code beneath, can anybody assist me out right here?
Code for the signup kind sidebar.php
– This isn’t a plugin.
<kind motion="newsletter_signup.php" methodology="put up">
<p><enter class="full" sort="textual content" title="title" placeholder="Your title*"></p>
<p><enter class="full" sort="e-mail" title="E mail" placeholder="Your e-mail deal with*"></p>
<p><enter sort="submit" class="sub-btn" worth="Subscribe"></p>
</kind>
The code within the newsletter_signup.php
file:
<?php
require_once('wp-load.php');
$title = $_POST['name'];
$E mail = $_POST['Email'];
$to = 'me@myself.com';
wp_mail($to, $title, 'From: ' . $E mail);
echo 'Your request Has Been Despatched, Thank You. ';
?>