hi
this is not working.how to do that.....

form1
<form method="get" action="email2.php">
<table>
<tr><td>Subject:</td><td><input type="text" name="subject" size="70"></td></tr>
<tr><td></td><td><textarea name="body1" cols="70" rows="20"></textarea></td></tr>
<tr><td><input type="submit" name="send" value="submit"></td></tr>
</table>
</form>

php page
<form>
<?php
$subject1=$_REQUEST;

$message=$_REQUEST;

$hostname = "localhost";
$username = "splendor_lydia";
$password = "jesus";
$dbid = "splendor_aletheia";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");

if (isset($_REQUEST))
{

$subject="Test mail";

$from="yourname@domain.com";

$query="select email,name from member" or die("ERROR:".mysql_error());

$result=mysql_query($query);

while($row=mysql_fetch_array($result)){

$email=$row[0];

$name = $row[1];

email($email,$subject,$message,$from);

echo "Thanks";
}


?>
</form>

email($email,$subject,$message,$from); thsi is worng

use this

mail($email,$subject,$message,$from);

hi,
it is not working....

<form>
<?php
$subject1=$_REQUEST;

$message=$_REQUEST;

$hostname = "localhost";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");

if (isset($_REQUEST))
{

$subject="Test mail";

$from="yourname@domain.com";

$query="select email,name from member" or die("ERROR:".mysql_error());

$result=mysql_query($query);

while($row=mysql_fetch_array($result)){

$email=$row[0];

$name = $row[1];

mail($email,$subject,$message,$from);

echo "Thanks";
}


?>
</form>

I dont see a closing brace of if (isset($_REQUEST['submit'])) .
$username and $password is not declared.
And, $from="yourname@domain.com"; should be $from = "From: [email]yourname@domain.com[/email]";

this is my code...when admin logs in ..he will be entering the subject and the mail..when he click submit..mail must be sent to all the user in the table

if (isset($_REQUEST))
{

$subject="Test mail";

$from ="From: yourname@domain.com";

$query="select email,name from member" or die("ERROR:".mysql_error());

$result=mysql_query($query);

while($row=mysql_fetch_array($result)){

$email=$row[0];

$name = $row[1];

mail($email,$subject,$message,$from);

echo "Thanks";
}

Before sending the mail, try to print what's in $email. Or, hardcode email address and try sending a mail. I am sure something goes wrong while fetching the data from the database cuz it works here.

Okay ! There is no problem with your script. There must be some problem with your smtp configuration. Open php.ini and look for [mail function]. See if smtp is set to your outgoing mail server.

thanks a lot...it is working in another site,the previous one did not support smpt

This question has already been answered. Start a new discussion instead.