Page 1 of 1

Send Emails to selected people

Posted: Mon Mar 29, 2010 12:33 am
by chethaka
i want to send a email to selected people in my database.And i know how to use mail() function. :)

from while loop i can retrieve all mail addresses. but how to select addresses separably.

Code: Select all

while($new=mysql_fetch_array($result2)){
$email=$new['email'];
echo $email."<br>";
}
here is the result and how to send mails only to aaaa and cccc.
aaaa@mail.com
bbbb@mail.com
cccc@mail.com
dddd@mail.com

Thanks,
..::chethaka::..

Re: Send Emails to selected people

Posted: Mon Mar 29, 2010 7:16 am
by greyhoundcode
chethaka wrote:i want to send a email to selected people in my database ... here is the result and how to send mails only to aaaa and cccc.
We can hardly answer that if we don't know the criteria for your "selected people."

Might this not be accomplished with your original SQL query, depending on what fields exist in the relevant table? For instance,

Code: Select all

-- Instead of this:
SELECT `email` FROM `customers`;

-- Something like this:
SELECT `email` FROM `customers` WHERE `loyaltyscheme`=TRUE;