php mail(0 sent but not received!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • poopsy
    New Member
    • Nov 2006
    • 50

    php mail(0 sent but not received!!

    hello
    I have been trying to send email to a group of users found in my database, but the problem is the email is being sent but not received. I have also tried sending only to one recipient, it does not work either. I have already hosted my site

    here is my code:

    1st page

    Code:
    <html>
    <head>
    <title>Mailing List</title>
    </head>
    
    <body>
    <form method="post" action="log5.php">
    <table align="center" bgcolor="#D6DEE7" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td align="center">
    <b><h2>MAILING LIST ADMIN</h2></b>
    
    
    Send message to:
    <select name="receiver" size="1" style="background-color: #F7F7F7">
    <option selected value="all">Reviewer</option>
    <option value="notall">Author</option>
    </select><br />
    <br />
    
    Title or Subject: <input name="subject" type=text maxlength=100 size=40>
    <br />
    <br />
    Message:
    <textarea wrap name="message" rows=10 cols=45></textarea>
    <br /><br />
    <input type=submit name="submit" value="SUBMIT">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    and the log.php page:

    Code:
    <?php
    include("db_connect.php");
       
       
       $tom = $_POST['receiver'];
      $subject = $_POST['subject'];
      $message = $_POST['message'];
      $country = $_POST['country'];
      $headers = 'From: myemail@yahoo.com'; 
    
      if ($tom == "all") {
    $result = mysql_query("SELECT Reviewer_email FROM reviewer");
    
    	$count = 0;
    		while ($row = mysql_fetch_array ($result, MYSQL_ASSOC))
    		{
    		$to = $row['Reviewer_email'];
    		mail($to, $subject, $message, $headers);
    		$count++;
    		}
    
    	echo "myResult=$count Emails Sent. Done.";
    }
    
     if ($tom == "notall") {
     
    
    	$result1 = mysql_query("SELECT Author_email FROM author");
    
    	$count1 = 0;
    		while ($row1 = mysql_fetch_array ($result1, MYSQL_ASSOC))
    		{
    		$to = $row1['Author_email'];
    		mail($to, $subject, $message, $headers);
    		$count1++;
    		}
    
    	echo "myResult1=$count1 Emails Sent. Done.";
    	
    
    }
    ?>
    <html>
    <head>
    </head>
    <body>
    SUCCESS!
    </body>
    </html>
    is there something wrong in my codes??
    plzzz help
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Here are some steps to help with debugging:
    • Turn On Debugging Messages.
    • Check your functions return true (i.e., they work) by using an IF conditional *.
    • Use the mysql_error() function to return any errors mysql generates for the current resource **.


    Tell us any errors you receive.

    Have you checked your spam box?

    * Using an IF:
    Code:
    if ( mail( [...] ) )
    {
        // mail was sent successfully.
    }
    ** mysql_error()
    Code:
    $sql = "SELECT * FROM `tbl_1`";
    // If mysql_query() evalutes to false, die with query error.
    $result = mysql_query( $sql ) or die( mysql_error() );

    Comment

    Working...