help with this code
Posted: Fri Jun 19, 2009 7:35 am
i want to retrive emails adds from db and i want to send one email to all of them ..it retrives emails from the data base but i want to to send mail to all the email adresses it retrives but it doesnt send it to all rather it sends the mail to the last one email address.please tell me whats wrong here.
<?php
require ('C:\wamp\bin\php\php5.2.6\PEAR\Mail.php');
require ('C:\wamp\bin\php\php5.2.6\PEAR\Mail\mime.php');
//require_once('auth.php');
include("conn.php");
$sql="SELECT * FROM emails ";
$result = connect($sql);
while($row = mysql_fetch_array($result)){
$email= $row['email_add'];
echo $email;
}
//
$sender = "abc@gmail.com"; // Your email address
//$recipient ="xyz@yahoo.com, abbc@hotmail.com";
$recipient = $email;
//$recipient = $_REQUEST['email']; // The Recipients name and email address
$subject ="Machines Error Report"; // Subject for the email
$text = 'This is a text message.'; // Text version of the email
//$date=$_REQUEST['AnotherDate'];
$abc=$_REQUEST['messag'];
//$subject=$_REQUEST['Subject'];
$mac=$_REQUEST['machine'];
$today = date("F j, Y, g:i a");
<?php
require ('C:\wamp\bin\php\php5.2.6\PEAR\Mail.php');
require ('C:\wamp\bin\php\php5.2.6\PEAR\Mail\mime.php');
//require_once('auth.php');
include("conn.php");
$sql="SELECT * FROM emails ";
$result = connect($sql);
while($row = mysql_fetch_array($result)){
$email= $row['email_add'];
echo $email;
}
//
$sender = "abc@gmail.com"; // Your email address
//$recipient ="xyz@yahoo.com, abbc@hotmail.com";
$recipient = $email;
//$recipient = $_REQUEST['email']; // The Recipients name and email address
$subject ="Machines Error Report"; // Subject for the email
$text = 'This is a text message.'; // Text version of the email
//$date=$_REQUEST['AnotherDate'];
$abc=$_REQUEST['messag'];
//$subject=$_REQUEST['Subject'];
$mac=$_REQUEST['machine'];
$today = date("F j, Y, g:i a");