hallo there, so here s the deal, i use php mailer to send mail to multiple directions. i get the mail addresses from a database.. so here's the code . . $title=$_POST['title']; $subject=$_POST['title']; $author=$_POST['author']; $news=$_POST['news']; $today= date('Y M d'); $message = $today."\n\name: ".strip_tags(stripslashes($_POST["author"]))."\ntitle: ".strip_tags(stripslashes($_POST["title"]))."\nMessage: ".strip_tags(stripslashes($_POST["news"]))."\n"; require_once("pmailer/class.phpmailer.php"); $mail = new PHPMailer(); $mail -> IsSMTP(); $mail -> Host = "websitemail"; $mail->Mailer = "smtp"; $mail -> Username = "name"; $mail -> Password = "psw"; $mail->SMTPAuth = "true"; $mail -> From = " iekkozan@sch.gr"; $mail -> FromName = "I.E.K ÊÃÆÃÃÇÓ"; $query=mysql_query("SELECT mail FROM members WHERE mail != ''"); while ($m=mysql_fetch_array($query)) { $maddress=$m[mail]; $mail -> AddAddress($maddress, "IEK KOZANIS"); $mail -> CharSet = "ISO-8859-7"; $mail -> Subject = $subject; $mail -> Body = $message; if($mail->Send()) { // echo ""; exit; } else { //echo ""; exit; } } Code (markup): it works! but the mail to each direction arrives 2-3 times!! why? i want just one mail to be sent to each direction. one time..... could u help me??
? i just downloaded it and installed it. i did not mess with that class at all.. should i?? i can not post it because it is too long..... the system doesnt allow me..
someone please help me with this. i put in my mail list 45 different email addresses and i sent my first newsletter. every addressee received the mail 45 times!! total desaster. in the previous messages i was testing the service only with 2 addresses in my email table thats why i was receiving the mail only 2 times. what should i do??????????
pretty good idea but i just implemented it using another way here is the code to send emails to multiple direction. my way... //connect to database.....done $query=mysql_query("SELECT email FROM newsletter WHERE email != ''"); while ($m=mysql_fetch_array($query)) { $maddress=$m[email]; require_once("pmailer/class.phpmailer.php"); $mail = new PHPMailer(); $mail -> IsSMTP(); $mail -> Host = "websitemail"; $mail->Mailer = "smtp"; $mail -> Username = "myusername"; $mail -> Password = "my psw"; $mail->SMTPAuth = "true"; $mail -> From = " iekkozan@sch.gr"; $mail -> FromName = "I.E.K "; $mail -> AddAddress($maddress, "iek"); $mail -> CharSet = "ISO-8859-7"; $mail -> Subject = $subject; $mail -> Body = $message; if($mail->Send()) { echo "ok"; } else { echo "not ok"; } } Code (markup): maybe not the best way but it works,,,,