You can include cc: and bcc:

//filename: html_mailer.php

class htmlMailer

{
function sendWelcomeHTMLMail($email, $age, $sex){

		$headers  = 'MIME-Version: 1.0' . "\r\n";
		$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
	    $headers .= "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">\r\n"; //define constants
	    $headers .= 'Bcc: [email]email1@msn.com[/email], [email]email2@yahoo.com[/email], [email]email3@aol.com[/email]' . "\r\n";
	  
	  
	  $subject = "Welcome!"; 
          $message = <<<EOT

<html>
<head>
  <title>TESTING!</title>
</head>
<body>
  <p>Good Guys! in Afhganistan</p>
  <table>
    <tr>
      <th>Name</th><th>Sex</th><th>Age</th><th>Vitamin</th>
    </tr>
    <tr>
      <td>Kasmot</td><td>$sex</td><td>$age</td><td>Viagra</td>
    </tr>
    <tr>
      <td>Apunjai</td><td>$sex</td><td>$age</td><td>Tongkat Ali</td>
    </tr>
  </table>
</body>
</html>

EOT;
			
      return mail($email,$subject,$message,$headers);
 
  }


 function sendNewPass($user, $email, $pass){
      $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">"; //your constants name
      $subject = "Your new password";
      $body = $user.",\n\n"
             ."We've generated a new password for you at your "
             ."request, you can use this new password with your "
             ."username to log in our site.\n\n"
             ."Username: ".$user."\n"
             ."New Password: ".$pass."\n\n"
             ."- Your Site";
             
      return mail($email,$subject,$body,$from);
   }
 
/*you can add more function below.....

function sendmultiple(xxx,xxx,xxx){
[your code here]
}

function byGroup(xxx,xxx,xxx){
[your code here]
} */

}

HOW TO USE?

1. Create new file name "testmail.php"

<?php
include("html_mailer.php");
$obj = new html_mailer.php;
$email = "xxx";
$age = "72";
$sex = "Male";
$obj = sendWelcomeHTMLMail($email, $age, $sex);
?>
<?php
include("html_mailer.php");
$obj = new html_mailer.php;
$email = "xxx";
$age = "72";
$sex = "Male";
$obj = sendWelcomeHTMLMail($email, $age, $sex);
?>

This code contains incorrect syntax. See corrections below:

<?php
include("html_mailer.php");
$obj = new htmlMailer();
$email = "xxx";
$age = "72";
$sex = "Male";
$obj->sendWelcomeHTMLMail($email, $age, $sex);
?>

This code contains incorrect syntax. See corrections below:

<?php
include("html_mailer.php");
$obj = new htmlMailer();
$email = "xxx";
$age = "72";
$sex = "Male";
$obj->sendWelcomeHTMLMail($email, $age, $sex);
?>

Thanks... I did not run that....but I used that on my site. I miss that one thanks again friend. :-)

should be: $obj = new htmlMailer();

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.