Login   Register  
PHP Classes
elePHPant
Icontem

multiple recipeant

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      activeMailLib  >  All threads  >  multiple recipeant  >  (Un) Subscribe thread alerts  
Subject:multiple recipeant
Summary:how to send mails to multi recepiants
Messages:5
Author:Tharange Priyankere
Date:2007-01-01 07:12:59
Update:2007-01-02 08:50:32
 

  1. multiple recipeant   Reply  
Picture of Tharange Priyankere
Tharange Priyankere
2007-01-01 07:12:59
Show me how to send an email to multi recipeants.

On my try it says "This email seems to be invalid:abc@abc.com,xyz@zyx.edu"

then I set $to =array("abc@abc.com","xyz@zyx.edu") an internal error occoured.........


Please tell me how to type two email address in TO text box on test.php at run time. or how to edit the code to send mails to multiple recepiants.



  2. Re: multiple recipeant   Reply  
Picture of paul
paul
2007-01-02 08:29:54 - In reply to message 1 from Tharange Priyankere
Dear
the easiest way to do this is using phpmailer
http://phpmailer.sourceforge.net/
follow the instructions and it should work like a charm
below you will find the example code they used on their site
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->From = "list@mydomain.com";
$mail->FromName = "List manager";
$mail->Host = "smtp1.site.com;smtp2.site.com";
$mail->Mailer = "smtp";

@MYSQL_CONNECT("localhost","root","password");
@mysql_select_db("my_company");
$query = "SELECT full_name, email, photo FROM employee WHERE id=$id";
$result = @MYSQL_QUERY($query);

while ($row = mysql_fetch_array ($result))
{
// HTML body
$body = "Hello <font size=\"4\">" . $row["full_name"] . "</font>, <p>";
$body .= "<i>Your</i> personal photograph to this message.<p>";
$body .= "Sincerely, <br>";
$body .= "PHPMailer List manager";

// Plain text body (for mail clients that cannot read HTML)
$text_body = "Hello " . $row["full_name"] . ", \n\n";
$text_body .= "Your personal photograph to this message.\n\n";
$text_body .= "Sincerely, \n";
$text_body .= "PHPMailer List manager";

$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($row["email"], $row["full_name"]);
$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");

if(!$mail->Send())
echo "There has been a mail error sending to " . $row["email"] . "<br>";

// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();
}



kind regards
Paul

  3. Re: multiple recipeant   Reply  
Picture of paul
paul
2007-01-02 08:32:54 - In reply to message 1 from Tharange Priyankere
Dear
the easiest way to do this is using phpmailer
http://phpmailer.sourceforge.net/
follow the instructions and it should work like a charm
below you will find the example code they used on their site
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->From = "list@mydomain.com";
$mail->FromName = "List manager";
$mail->Host = "smtp1.site.com;smtp2.site.com";
$mail->Mailer = "smtp";

@MYSQL_CONNECT("localhost","root","password");
@mysql_select_db("my_company");
$query = "SELECT full_name, email, photo FROM employee WHERE id=$id";
$result = @MYSQL_QUERY($query);

while ($row = mysql_fetch_array ($result))
{
// HTML body
$body = "Hello <font size=\"4\">" . $row["full_name"] . "</font>, <p>";
$body .= "<i>Your</i> personal photograph to this message.<p>";
$body .= "Sincerely, <br>";
$body .= "PHPMailer List manager";

// Plain text body (for mail clients that cannot read HTML)
$text_body = "Hello " . $row["full_name"] . ", \n\n";
$text_body .= "Your personal photograph to this message.\n\n";
$text_body .= "Sincerely, \n";
$text_body .= "PHPMailer List manager";

$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($row["email"], $row["full_name"]);
$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");

if(!$mail->Send())
echo "There has been a mail error sending to " . $row["email"] . "<br>";

// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();
}



kind regards
Paul

  4. Re: multiple recipeant   Reply  
Picture of paul
paul
2007-01-02 08:35:44 - In reply to message 1 from Tharange Priyankere
Dear
the easiest way to do this is using phpmailer
http://phpmailer.sourceforge.net/
follow the instructions and it should work like a charm
below you will find the example code they used on their site
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->From = "list@mydomain.com";
$mail->FromName = "List manager";
$mail->Host = "smtp1.site.com;smtp2.site.com";
$mail->Mailer = "smtp";

@MYSQL_CONNECT("localhost","root","password");
@mysql_select_db("my_company");
$query = "SELECT full_name, email, photo FROM employee WHERE id=$id";
$result = @MYSQL_QUERY($query);

while ($row = mysql_fetch_array ($result))
{
// HTML body
$body = "Hello <font size=\"4\">" . $row["full_name"] . "</font>, <p>";
$body .= "<i>Your</i> personal photograph to this message.<p>";
$body .= "Sincerely, <br>";
$body .= "PHPMailer List manager";

// Plain text body (for mail clients that cannot read HTML)
$text_body = "Hello " . $row["full_name"] . ", \n\n";
$text_body .= "Your personal photograph to this message.\n\n";
$text_body .= "Sincerely, \n";
$text_body .= "PHPMailer List manager";

$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($row["email"], $row["full_name"]);
$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");

if(!$mail->Send())
echo "There has been a mail error sending to " . $row["email"] . "<br>";

// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();
}



kind regards
Paul

  5. Re: multiple recipeant   Reply  
Picture of paul
paul
2007-01-02 08:50:32 - In reply to message 4 from paul
sorry my browser is acting up here at work did not intend to send this reply 3 times
mod please remove the unnessecairy replies

kind regards
Paul