breaststroke
Programmer
Hello,
I have a problem involving Phpmailer and a While loop. Actually I have always had problems to sending emails this way. Now for instance I can send e-mails trough an IF (instead of While) and the following script works fine. But as soon as I change it into While it doesn't. Even the last part of the script (UPDATE) doesn't work (it worked upon IF). I am trying with just two e-mails to be sent and only the first one is sent.
I would be so happy to solve this issue. While loop is really important when it comes to sending e-mails.
This is my script:
Thank you very much in advance for any help.
Regards!
enjoy practicing languages at:
I have a problem involving Phpmailer and a While loop. Actually I have always had problems to sending emails this way. Now for instance I can send e-mails trough an IF (instead of While) and the following script works fine. But as soon as I change it into While it doesn't. Even the last part of the script (UPDATE) doesn't work (it worked upon IF). I am trying with just two e-mails to be sent and only the first one is sent.
I would be so happy to solve this issue. While loop is really important when it comes to sending e-mails.
This is my script:
PHP:
...
include('conexioninclude.php');
mysql_set_charset('utf8');
$registros=mysql_query("SELECT mail, name, password, codigo FROM alert WHERE status='on' AND language1='$language2' AND language2='$language1' AND way LIKE '%$way%' ORDER BY codigo",$conexion)or
die("Problems at selectt:".mysql_error());
require("class.phpmailer.php");
$mail = new PHPMailer();
while($reg=mysql_fetch_array($registros))
{
$mailu=$reg['mail'];
$namee=$reg['name'];
$password=$reg['password'];
$codigo=$reg['codigo'];
$mail->IsSMTP();
$mail->Port = 465;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->Username = "xxxxx";
$mail->Password = "xxxxxx"; // SMTP password
$webmaster_email = "xxxxxx"; //Reply to this email ID
$email="xxxxx"; // Recipients email ID
$name="Admin"; // Recipient's name
$mail->From = "xxxxxx";
$mail->FromName = "Sharinglanguage.com";
$mail->AddAddress($mailu,$namee);
$mail->AddReplyTo(xxxxxx,"Webmaster");
$mail->WordWrap = 50; // set word wrap
$mail->SetLanguage("en","/php/language/");
$mail->AddAttachment("/var/tmp/file.tar.gz");
$mail->AddAttachment("/tmp/image.jpg", "phone.jpg");
$mail->AddAttachment("image.jpg", "phone.jpg");
$mail->IsHTML(true); // send as HTML
$mail->Subject = "xxxxxxxxx";
$foto= "imagess/bonito.jpg";
$mensaje='<font-color="#559999">
<img src="'. $foto .'" width="600"><br /><br />
Hello '.$namee.',<br /><br />
xxxxxxxxxxxxxxxx .<br /><br />
Sincerely yours</font>';
$mail->MsgHTML($mensaje);
if(!$mail->Send())
{
print<<<HERE
message wasn't sent;
HERE;
}
else
{
$registros2=mysql_query("SELECT yep FROM vamos WHERE password='$password'",$conexion)or
die("Problems at selectt:".mysql_error());
if($reg=mysql_fetch_array($registros))
{
$yep=$reg['yep']; // it's an Int type field (numbers)
$saw=$yep+1;
$registros3=mysql_query("UPDATE vamos
SET yep='$saw'
WHERE password='$password'",$conexion)or
die("Proble8uhims with selectttt:".mysql_error());
}
print<<<HERE
success!;
HERE;
}
...
Thank you very much in advance for any help.
Regards!
enjoy practicing languages at: