Hear i have added 560 Email Ids into my database, but i have to send the mail at a time. so the column is 'email', for sendig the email for that particular column of emails i have used the following script.., but it giving the message Message delivery failed..., What's wrong please help it is very important for me Thanks a lotttt. <table class="ex"> <td> <?php include('db_n.php'); $data = mysql_query("SELECT * FROM appsubmitn") or die(mysql_error()); Print "<table CLASS=b> Send Mail To All The Clients In Your Database: "; include('header.php'); ?> <?php while($info = mysql_fetch_array( $data )) { Print "<tr>"; //___________sending mail__________ $to = "info['email']"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } //___________end mail__________ Print "<td>".$info['email']. "</td>"; } Print "</table>"; ?> </td></table> PHP:
It's possible that some emails aren't well formatted in which case mail() would fail. It's also possible that you don't have a working mail system on your server. Check your php.ini and see if a sendmail_path is set.
Use $to = $info['email']; and not $to = info['email']; And also check whether the emails are valid or not
Ha so all the emails were invalid because the $to variable was empty/null/whatever. I should have seen that missing $ before info.
Thanks my dear friends...., and special thanks to roopajyothi, gapz101 Yours working 100.1% thank you a lot