phppup Posted November 9, 2011 Share Posted November 9, 2011 I have a database with three fields: name, email, and event. People signed on through a form and provided this information each time they wanted a ticket to attend Thanksgiving, Christmas, and New Years parties. Now I want to contact them by email WITHOUT using a CC or BCC function because I do NOT want my messages filtered as spam. How can I send each person a single email? Quote Link to comment https://forums.phpfreaks.com/topic/250745-emailing-each-record-of-database/ Share on other sites More sharing options...
Rifts Posted November 9, 2011 Share Posted November 9, 2011 for loop should work Quote Link to comment https://forums.phpfreaks.com/topic/250745-emailing-each-record-of-database/#findComment-1286458 Share on other sites More sharing options...
joel24 Posted November 9, 2011 Share Posted November 9, 2011 send an email for each iteration of the while loop... this will take up many more resources than if you had used CC or BCC, someone else may know a better solution? another option to deter spam filtering - send it via gmail's SMTP (if you've signed up to use google mail with your domain) $sql=@mysql_query("SELECT name, email FROM people WHERE event='christmas'"); #whichever event while ($row=mysql_fetch_assoc($sql)) { mail($row['email'],'the subject','the message'); } Quote Link to comment https://forums.phpfreaks.com/topic/250745-emailing-each-record-of-database/#findComment-1286460 Share on other sites More sharing options...
phppup Posted November 9, 2011 Author Share Posted November 9, 2011 Some attendees submitted duplicate (but identical) information into the form in order to obtain more than one ticket, so they occuppy several record lines. However, I only need to send ONE email to that person. How can I filter through the records to make sure that only one email is sent even though the same email address may have been entered several times, so that I eliminate duplication? In other words, to send ONE email to each UNIQUE address. Quote Link to comment https://forums.phpfreaks.com/topic/250745-emailing-each-record-of-database/#findComment-1286465 Share on other sites More sharing options...
xyph Posted November 9, 2011 Share Posted November 9, 2011 Google might help with that http://www.google.com/search?q=unique+values+from+mysql Please use it next time. Quote Link to comment https://forums.phpfreaks.com/topic/250745-emailing-each-record-of-database/#findComment-1286476 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.