mass mailing
-
- Posts: 1
- Joined: Mon Jul 23, 2012 8:07 am
mass mailing
how can i restrict the automatic mailing to all users who subscribed the email alerts.my question is when new user is subscribing the automatic mail is sent to all users who are already in mysql db..how can i stop to mailing to already registered users
Re: mass mailing
Check if the user has clicked the submit button, then set up a mail(); thingy.
You'll want to look more deeply into checking if the user is already subscribed before sending the 'success' email, and maybe add a touch more security to everything. Like maybe a captcha or anti-robot question.
Oh, and you may want to change the subject... I'm pretty sure that'll end up in spam XD
if(isset($_POST["submit"])){ // Do the actual subscription first $to = $_POST["email"]; $headers = 'From: webmaster@example.com' . "\r\n" . $subject = "You have subscribed to us!"; 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $message = "You're now subscribed to our newsletter!"; mail($to, $subject, $message, $headers); }Depending on what you're doing, you may want to send the latest newsletter to the new subscriber. Simply change the $message variable to whatever you want. Maybe a database thing.
You'll want to look more deeply into checking if the user is already subscribed before sending the 'success' email, and maybe add a touch more security to everything. Like maybe a captcha or anti-robot question.
Oh, and you may want to change the subject... I'm pretty sure that'll end up in spam XD
Re: mass mailing
Depends how you know they have registered ? If there name is in another table check for that, if there is a column that gets set to 1 check for that. No way to answer fully unless you give a bit more information.umamaheswararao wrote:how can i restrict the automatic mailing to all users who subscribed the email alerts.my question is when new user is subscribing the automatic mail is sent to all users who are already in mysql db..how can i stop to mailing to already registered users
Re: mass mailing
Wow.. I completely read that wrong :/umamaheswararao wrote:to all users who subscribed the email alerts.