email - php not running script -
i want send mails using php. have take mails id database fetching data tables , using mail functions when going server , run shows nothing blank page appears site pligg cms base site
<html> <head> <title>sending html email using php</title> </head> <body> <?php $mysql_host = "localhost"; $mysql_database = "db"; $mysql_user = "r"; $mysql_password = "s#1#"; $con=mysql_connect($mysql_host,$mysql_user,$mysql_password); if(!$con) { echo "can't connect"; die("failed connect".mysql_error()); } $db_select=mysql_select_db($mysql_database); if(!$db_select) { echo "db not connected"; die(" failed user".mysql_error()); } $query1 = "select * pligg_users" $subject = "exclusive facebook cover offer."; $message = "hello"; $message .= " <a href='www.getlikeseasy.com'>read more</a>"; $message = wordwrap($message,70); $headers = "mime-version: 1.0" . "\r\n"; $headers .= "content-type:text/html;charset=utf-8" . "\r\n"; $results = mysql_query($query1); if(!$results) { echo "query"; die(mysql_error()); } while($result_array = mysql_fetch_array($results)) { $c = $result_array['user_email']; $retval = mail($c,$subject,$message,$headers); if( $retval == true ) { echo .$i." message sent successfully... to".$c; echo "<br>"; } else { echo .$i." message not sent... to".$c; echo "<br>"; } $i++; } echo "email sent"; ?> <?php mysql_close($con); ?> </body> </html>
blank pages result of syntax errors.
you're missing semi-colon here:
$query1 = "select * pligg_users"
i don't know if fix of help.
edit:
on code below have placed '.' before echoing variable on lines 3 , 8, remove well.
if( $retval == true ) { echo .$i." message sent successfully... to".$c; echo "<br>"; } else { echo .$i." message not sent... to".$c; echo "<br>"; }
note: try looking getting errors displayed can work these things out bit easier.
Comments
Post a Comment