Connecting Tech Pros Worldwide Forums | Help | Site Map

Send Multiple Emails

Newbie
 
Join Date: Mar 2008
Posts: 1
#1: Mar 18 '08
Hi, I am using PHP mailer to send out 2 different emails.

The problem I am having is only the first email is ever sent out.

Below is my code. The first email $to but i add two mail id mail not sending.

Please help....this is urgent!
[php]$mail = new PHPMailer();
$mail->From = "palani@xxxx.com";
$mail->FromName = " manager";
$mail->Host = "xxxxx.com";
$mail->Mailer = "smtp";
$body .= " manager";
$text_body .= "Sincerely, \n";
$text_body .= "manager";
$mail->Body = $body;
$mail->AltBody = $text_body;
$to='palan@xxxxx.com'; //here add to two mail id
$mail->AddAddress($to,'palani'); if(!$mail->Send())
echo "There has been a mail error sending to ";
// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
?>[/php]
reply me

Member
 
Join Date: Jan 2008
Posts: 32
#2: Mar 18 '08

re: Send Multiple Emails


I use :

[PHP]//php mailer created above....
$mail->AddAddress("abc@xyz.com", "Guy #1");
$mail->AddAddress("def@xyz.com", "Guy #2");
//email sent further down....[/PHP]
ronverdonk's Avatar
Moderator
 
Join Date: Jul 2006
Location: The Netherlands
Posts: 4,139
#3: Mar 18 '08

re: Send Multiple Emails


Welcome to TSDN!

Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

MODERATOR
Reply