I'm setting up a Magento website and before it goes live I want to set up a under construction page.
I'd like to have people who are interested to subscribe and we'll send them out a email when the shop goes live.
I tried out bunch of these bigger PHP mailing/newsletter systems, but they were way to complicated and time consuming to get into because I need to work on other things.
So I'd like to know is there a easy way to do it myself or is there a script just for this task I haven't found yet? I also searched through few tutorial sites for what I was looking for, but I couldn't find anything useful. I really just need the bare minimum for this.
Thank you in advance, hopefully this question fits to this site.
use this in your page:
<!-- Subscription Form -->
<form action="form/form.php" method="post">
<input name="email" class="email" type="text" placeholder="Enter your email address ...">
<button type="submit" class="btn_email">Send</button>
</form>
<!-- End Subscription Form -->
and this for form.php:
<?php
$to = "[email protected]";
$from = "[email protected]";
$headers = "From: " . $from . "\r\n";
$subject = "New subscription";
$body = "New user subscription: " . $_POST['email'];
if( filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) )
{
if (mail($to, $subject, $body, $headers, "-f " . $from))
{
echo 'Your e-mail (' . $_POST['email'] . ') has been added to our mailing list!';
}
else
{
echo 'There was a problem with your e-mail (' . $_POST['email'] . ')';
}
}
else
{
echo 'There was a problem with your e-mail (' . $_POST['email'] . ')';
}
the above script will only send you an email with the new subscription, but you can extend it to do database insertion, subscriber confirmation, etc. And also validate the data in the field where the subscriber enter the email.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With