Código PHP:
$sql = $db->Execute("SELECT email FROM MEMBERS);
for($i=0;$i < $sql->numrows();++$i)
{
$row = $sql->fetchrow();
require_once '../mail/SMTP.php';
// aqui biene todo el sistema para envio de correo
$f = '[email protected]'; // from (Gmail mail address)
$t = $row[0]; // to mail address
$p = 'xxxxxx'; // Gmail password
$m = 'From: '.$f."rn".
'To: '.$t."rn".
'Subject: test3'."rn".
'Content-Type: text/plain'."rnrn".
'Text message para anonimo.';
$c = fsockopen('tls://smtp.gmail.com', 465, $errno, $errstr, 10) or die($errstr);
if (!SMTP::recv($c, 220)) die(print_r($_RESULT));
if (!SMTP::ehlo($c, 'localhost')) SMTP::helo($c, 'localhost') or die(print_r($_RESULT));
if (!SMTP::auth($c, $f, $p, 'login')) SMTP::auth($c, $f, $p, 'plain') or die(print_r($_RESULT));
SMTP::from($c, $f) or die(print_r($_RESULT));
SMTP::to($c, $t) or die(print_r($_RESULT));
SMTP::data($c, $m) or die(print_r($_RESULT));
SMTP::quit($c);
@fclose($c);
echo 'Sent !';
}
Saludos