BarneyJoe Posted January 17, 2007 Share Posted January 17, 2007 Can anyone let me know how to go about this?Basically have a customer sign up form a site, where they can check a box to say they want to receive updates / offers etc.So what I'm looking to do is enable the site owner to send emails to all those who have done so from the site.ie get addresses from the email field in the cutomers table where the value of the receiveUpdates field = yes.How would it typically work exactly - I imagine a form on a page where the owner can type in a title and message, hit a button that actions a php page that retrieves the correct records, and sends out the email.Cheers. Link to comment https://forums.phpfreaks.com/topic/34558-sending-emails-to-email-addresses-in-a-database/ Share on other sites More sharing options...
Pez Posted January 17, 2007 Share Posted January 17, 2007 You have the basic principles correct.Just make a normal form on the admin page for them to write the email then the php script would look something like this:$query = mysql_query("SELECT email FROM customers WHERE receiveUpdates = 'Yes'");while ($info = mysql_fetch_assoc($query)) { mail ($info[email], $_POST['subject'], $_POST['message']);}echo 'Emails sent.'; Link to comment https://forums.phpfreaks.com/topic/34558-sending-emails-to-email-addresses-in-a-database/#findComment-162887 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.