Dear all,
I have this lovely newsletter script. Basic, simple, but I'd like to add the following:
- how to have the email adres of the subscriber as sender (now sender = recipient)
- how to have an error message when there is nothing filled in but just clicked on send
Thanks!
Code:<?php if(isset($_POST['Email'])) { $recipient = "contact@mysite.com"; $subject = "Newsletter subscription"; $sender = $recipient; $body .= "Add this email adress to the newsletter: \n"; $body .= " ".$_REQUEST['Email']." \n"; mail( $recipient, $subject, $body, "From: $sender" ) or die ("Mail could not be sent."); echo "<div>thanks for subscribing</div>"; } ?> <form method="POST" class="subscriber-form" action="#newsletter"> <input type="text" class="form-control input-lg" name="Email" placeholder="your@mailadress.com"> <button type="submit" class="btn btn-maincolor" id="send" value="Submit" name="Submit">subscribe</button> </form>



Reply With Quote

Bookmarks