A
Anonymous
Guest
i have created an email function to send an email from php codes.
i've got the error message like below when i tried to send an email.
i'm really dont know where to change my codes.
can anybody help me???
Notice: Undefined offset: 1 in c:\easyphp1-7\www\el\sendemail.php on line 31
Notice: Undefined offset: 2 in c:\easyphp1-7\www\el\sendemail.php on line 32
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\easyphp1-7\www\el\sendemail.php on line 36
newsletter sent to : rb_ed@yahoo.com
Completed sending emails
******************************************************************************************************
below is my codes:
<?php
//make a connection
$host="127.0.0.1";
$name = "el";
$pass = "";
$dbname = "el";
// Connect to Database and select the database to use
$dbi = mysql_connect($host, $name, $pass)
or die("I cannot connect to the database. Error :" . mysql_error());
mysql_select_db($dbname,$dbi);
$sql_query = "SELECT email FROM email";
$result = mysql_query($sql_query) or die("cannot execute query");
$header = "From : me";
//loop through rows
while ($row = mysql_fetch_array($result))
{
$address = $row[0];
//mail function requires email address($address)
//The subject($subject) , the message ($body) and
//the $header info
mail($address ,$subject , $body , $header);
//display a message confirming email has been sent
echo ("newsletter sent to : $address<br>");
}
echo ("Completed sending emails");
?>
i've got the error message like below when i tried to send an email.
i'm really dont know where to change my codes.
can anybody help me???
Notice: Undefined offset: 1 in c:\easyphp1-7\www\el\sendemail.php on line 31
Notice: Undefined offset: 2 in c:\easyphp1-7\www\el\sendemail.php on line 32
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\easyphp1-7\www\el\sendemail.php on line 36
newsletter sent to : rb_ed@yahoo.com
Completed sending emails
******************************************************************************************************
below is my codes:
<?php
//make a connection
$host="127.0.0.1";
$name = "el";
$pass = "";
$dbname = "el";
// Connect to Database and select the database to use
$dbi = mysql_connect($host, $name, $pass)
or die("I cannot connect to the database. Error :" . mysql_error());
mysql_select_db($dbname,$dbi);
$sql_query = "SELECT email FROM email";
$result = mysql_query($sql_query) or die("cannot execute query");
$header = "From : me";
//loop through rows
while ($row = mysql_fetch_array($result))
{
$address = $row[0];
//mail function requires email address($address)
//The subject($subject) , the message ($body) and
//the $header info
mail($address ,$subject , $body , $header);
//display a message confirming email has been sent
echo ("newsletter sent to : $address<br>");
}
echo ("Completed sending emails");
?>