Hi, in the code below, there are names and locations kept in database for the mail adresses, each mail adress could have many names and locations, in the code I wantto make if they enter email adress the querry searches the database and sends the name and location info to the that email adress, all are working but just it sends multiple mails to the user in each mail different info, but I want it to send all the info in 1 mail, all the different name infos in that mail body, waiting for ur help thx…
[php]<?php
include “baglan.php”;
require ‘admin/class.phpmailer.php’;
error_reporting(0);
$call=$_POST[‘email’];
$list=mysql_query(“select * from onaysiz where email=’$call’”);
while ($row=mysql_fetch_array($list)){
$name=$row[‘name’];
$location=$row[‘location’];
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = ‘smtp’;
$mail->SMTPAuth = true;
$mail->Host = ‘smtp.gmail.com’; // “ssl://smtp.gmail.com” didn’t worked
$mail->Port = 465;
$mail->SMTPSecure = ‘ssl’;// or try these settings (worked on XAMPP and WAMP)://
$mail->Port = 587;//
$mail->SMTPSecure = ‘tls’;
$mail->Username = “";
$mail->Password = "”;
$mail->CharSet = “UTF-8”;
$mail->IsHTML(true); // if you are going to send HTML formatted emails
$mail->SingleTo = true; // if you want to send a same email to multiple users. multiple emails will be sent one-by-one.
$mail->From = “****************”;
$mail->FromName = “***********”;
$mail->addAddress(“gönderilecek mail adresi”,“User 1”);
$mail->addCC("",“User 2”);
$mail->Subject = "Hello ";
$mail->Body = " $name $location";
if(!$mail->Send())
echo "Message was not sent
PHPMailer Error: " .
$mail->ErrorInfo;
else echo “Message has been sent”;
}
?>[/php]