473,396 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

php mail(0 sent but not received!!

50
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

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>Mailing List</title>
  4. </head>
  5.  
  6. <body>
  7. <form method="post" action="log5.php">
  8. <table align="center" bgcolor="#D6DEE7" border="0" cellpadding="0" cellspacing="0">
  9. <tr>
  10. <td align="center">
  11. <b><h2>MAILING LIST ADMIN</h2></b>
  12.  
  13.  
  14. Send message to:
  15. <select name="receiver" size="1" style="background-color: #F7F7F7">
  16. <option selected value="all">Reviewer</option>
  17. <option value="notall">Author</option>
  18. </select><br />
  19. <br />
  20.  
  21. Title or Subject: <input name="subject" type=text maxlength=100 size=40>
  22. <br />
  23. <br />
  24. Message:
  25. <textarea wrap name="message" rows=10 cols=45></textarea>
  26. <br /><br />
  27. <input type=submit name="submit" value="SUBMIT">
  28. </td>
  29. </tr>
  30. </table>
  31. </form>
  32. </body>
  33. </html>
  34.  
  35.  
and the log.php page:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include("db_connect.php");
  3.  
  4.  
  5.    $tom = $_POST['receiver'];
  6.   $subject = $_POST['subject'];
  7.   $message = $_POST['message'];
  8.   $country = $_POST['country'];
  9.   $headers = 'From: myemail@yahoo.com'; 
  10.  
  11.   if ($tom == "all") {
  12. $result = mysql_query("SELECT Reviewer_email FROM reviewer");
  13.  
  14.     $count = 0;
  15.         while ($row = mysql_fetch_array ($result, MYSQL_ASSOC))
  16.         {
  17.         $to = $row['Reviewer_email'];
  18.         mail($to, $subject, $message, $headers);
  19.         $count++;
  20.         }
  21.  
  22.     echo "myResult=$count Emails Sent. Done.";
  23. }
  24.  
  25.  if ($tom == "notall") {
  26.  
  27.  
  28.     $result1 = mysql_query("SELECT Author_email FROM author");
  29.  
  30.     $count1 = 0;
  31.         while ($row1 = mysql_fetch_array ($result1, MYSQL_ASSOC))
  32.         {
  33.         $to = $row1['Author_email'];
  34.         mail($to, $subject, $message, $headers);
  35.         $count1++;
  36.         }
  37.  
  38.     echo "myResult1=$count1 Emails Sent. Done.";
  39.  
  40.  
  41. }
  42. ?>
  43. <html>
  44. <head>
  45. </head>
  46. <body>
  47. SUCCESS!
  48. </body>
  49. </html>
  50.  
  51.  
is there something wrong in my codes??
plzzz help
Mar 14 '09 #1
1 3462
Markus
6,050 Expert 4TB
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:
Expand|Select|Wrap|Line Numbers
  1. if ( mail( [...] ) )
  2. {
  3.     // mail was sent successfully.
  4. }
  5.  
** mysql_error()
Expand|Select|Wrap|Line Numbers
  1. $sql = "SELECT * FROM `tbl_1`";
  2. // If mysql_query() evalutes to false, die with query error.
  3. $result = mysql_query( $sql ) or die( mysql_error() );
  4.  
Mar 14 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: NotGiven | last post by:
With the help from this group, I was able to change my Return-Path parameter seen in the full headers of email sent with mail(). Now I still see my userID in the parameter as shown here seen in...
1
by: a c s | last post by:
Hi there, my problem is as follows: When emailing a file using PHP 4.0.6, the attachment received is an empty "attachment.txt" file instead of the actual file I attached. Any suggestions why...
1
by: Patrick Dunnigan | last post by:
Hi, I am attempting a bulk copy from a c program into SQL Server 2000 using DBLib in freeTDS 0.63 RC11 (gcc 3.4.3, RH 9). I am getting an error message that I cannot find any documentation on. ...
4
by: zelzel.zsu | last post by:
I wrote two simple socket program. one for sending a file and the other for receiving the file. but when I run it, a curious thing happened. The received file was samller that the sent file. $...
2
by: Brian | last post by:
Hello, As the subject says is there an api the will allow me to view the packets sent/received just like the icon for the network properties? Any links, examples are appreciated. Brian
1
by: bonokoot | last post by:
Hello, I wrote this program in C# that accesses a SQL Server database that runs a stored procedure and sents the results in an email every 30min. I wrote this as a windows application instead of a...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
2
by: Macca | last post by:
My app has an asynchronous socket server. It will have 20 clients connected to the server. Each client sends data every 500 millisecondsThe Connections once established will not be closed unless...
2
by: Hughesie11 | last post by:
Im trying to post from a form to send an email, im using CDONTS ( I have to as it will be running on NT4), the object appears to get created fine, however the email is not sending, its generates 3...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.