Hi, this is my first post here...
I am very happy to be part of this community.
I am trying to make a script to send mails using a SMTP with a gmail account, the script seems to work...but sends the message only to the first 9 database rows...
this is the script:
	
I don't know where I am wrong....
I want this script to send emails to 100 adresses, gmails limit.
Thank you in advance and...I'm sorry for my english because is not that good...
					I am very happy to be part of this community.
I am trying to make a script to send mails using a SMTP with a gmail account, the script seems to work...but sends the message only to the first 9 database rows...
this is the script:
PHP Code:
	
	
<html>
<head>
<title>Gmail SMTP test</title>
</head>
<body>
<?php
error_reporting(E_STRICT);
date_default_timezone_set('America/Toronto');
require_once('../class.phpmailer.php');
//database login
$host = "localhost"; //database location
$user = "root"; //database username
$pass = ""; //database password
$db_name = "test"; //database name
//database connection
$link = mysql_connect($host, $user, $pass);
mysql_select_db($db_name);
 $adresa = mysql_query("SELECT email FROM users");
     $query = sprintf("SELECT * FROM users");
     
    $result = mysql_query($query);
     
    $count = 1;
    while ($row = mysql_fetch_assoc($result)) {
    
$mail             = new PHPMailer();
$body             = file_get_contents('contents.html');
$body             = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); 
$mail->Host       = "smtp.gmail.com"; 
$mail->SMTPDebug  = 1;                     
$mail->SMTPAuth   = true;
$mail->SMTPSecure = "ssl";
$mail->Host       = "smtp.gmail.com";
$mail->Port       = 465;
$mail->Username   = "account_username@gmail.com";
$mail->Password   = "account_password";
$mail->SetFrom($row['email'], 'My_Name');
$mail->AddReplyTo($row['email'], $row['email']);
$mail->Subject    = " Subject message!";
$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = $row['email'];
$mail->AddAddress($address, "name");
if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}
}
?>
</body>
</html>
I don't know where I am wrong....
I want this script to send emails to 100 adresses, gmails limit.
Thank you in advance and...I'm sorry for my english because is not that good...
Comment