Select in tabel si trimitere mail / newsletter
Scris: Mie Aug 24, 2011
salut!
Dupa ce adaug stirea in db si in site, trebuie sa-mi trimita mail la toti abonatii la newsletter, insa nu o face...
Dupa ce adaug stirea in db si in site, trebuie sa-mi trimita mail la toti abonatii la newsletter, insa nu o face...
Cod: Selectaţi tot
$result = addNews($titlu,$continut);
if (!$result) {
$q = "SELECT COUNT(*) FROM newsletter";
$res = mysql_query($q,$conexiune) or die(mysql_error());
while ( $list = mysql_fetch_assoc($res) ) {
//stocheaza datele returnate de mysql in variabile array pt fiecare coloana
$id[] = $list['id'];
$email[] = $list['email'];
}
for ($i = 0; $i < count($id);$i++ ) {
$sender = 'email@yahoo.com';
mail($email[$i],$titlu,$continut, 'FROM: '.$sender);
}
}