Connecting Tech Pros Worldwide Help | Site Map

message sent to mail go to spam mail

Member
 
Join Date: Dec 2008
Posts: 80
#1: Aug 27 '09
the code below is my mail code its working but message sent to the email is going to the spam mail not the inbox how can make the message go to indox

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once("connect.php");
  3.  
  4. // value sent from form
  5. $email_to=$_POST['email_to'];
  6.  
  7. // table name
  8. $tbl_name=members;
  9.  
  10. // retrieve password from table where e-mail = $email_to(mark@phpeasystep.com)
  11. $sql="SELECT password FROM $tbl_name WHERE email='$email_to'";
  12. $result=mysql_query($sql);
  13.  
  14. // if found this e-mail address, row must be 1 row
  15. // keep value in variable name "$count"
  16. $count=mysql_num_rows($result);
  17.  
  18. // compare if $count =1 row
  19. if($count==1){
  20.  
  21. $rows=mysql_fetch_array($result);
  22.  
  23. // keep password in $your_password
  24. $your_password=$rows['password'];
  25.  
  26. // ---------------- SEND MAIL FORM ----------------
  27.  
  28. // send e-mail to ...
  29. $to=$email_to;
  30.  
  31. // Your subject
  32. $subject="Your password here";
  33.  
  34. // From
  35. $header="from: your name <your email>";
  36.  
  37. // Your message
  38. $messages= "Your password for login to our website \r\n";
  39. $messages.="Your password is $your_password \r\n";
  40. $messages.="more message... \r\n";
  41.  
  42. // send email
  43. $sentmail = mail($to,$subject,$messages,$header);
  44.  
  45. }
  46.  
  47. // else if $count not equal 1
  48. else {
  49. echo "Not found your email in our database";
  50. }
  51.  
  52. // if your email succesfully sent
  53. if($sentmail){
  54. echo "Your Password Has Been Sent To Your Email Address.";
  55. }
  56. else {
  57. echo "Cannot send password to your e-mail address";
  58. }
  59.  
  60. ?>
  61.  
dlite922's Avatar
Expert
 
Join Date: Dec 2007
Location: Moon, Dark Side
Posts: 1,094
#2: Aug 27 '09

re: message sent to mail go to spam mail


I don't even need to look at your code. This is not a code problem. It is beyond your control, to a certain point.

If you domain is new, and doesn't have an SPF record, add one now (ask your provider, google it).
2. Make sure you have a valid "FROM" record. Most likely If this field is empty you won't even see it in any folder, mailservers automatically reject it.

Ask the mail service (yahoo, hotmail, aol, the company) to put you on the white list.

It will take some time and patience. Until then, avoid putting any images or HTML in the events.



Dan
hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#3: Aug 31 '09

re: message sent to mail go to spam mail


Verify that the MX and A records of your domain DNS configuration are set to the IP of the server from whom you are sending the mail.
(SPF - as Dan said)
Member
 
Join Date: Dec 2008
Posts: 80
#4: Sep 14 '09

re: message sent to mail go to spam mail


please can you explain further or i you saying i should add my smtp setting to the mail function if so how can i do that can give me an example
Member
 
Join Date: Sep 2008
Posts: 40
#5: Sep 14 '09

re: message sent to mail go to spam mail


Including the X-Mailer and Message-ID headers can also help in avoiding getting tagged as spam. I had the same problem, drove me nuts until I figured this out.
zorgi's Avatar
Member
 
Join Date: Mar 2008
Location: here
Posts: 107
#6: Sep 16 '09

re: message sent to mail go to spam mail


Or you can simply use PHPMailer and forget about how its done. I used it in the past and am very pleased with results. :

http://phpmailer.worxware.com/index.php
Member
 
Join Date: Dec 2008
Posts: 80
#7: 3 Weeks Ago

re: message sent to mail go to spam mail


the code below was a code give to me to solve me to stop my mail from going in to spam but i have a problem with line 16 how can i fix and what should i do i will appreciate if u will edit the problem on the code below

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include("Mail.php");
  3. /* mail setup recipients, subject etc */
  4. $recipients = "feedback@yourdot.com";
  5. $headers["From"] = "user@somewhere.com";
  6. $headers["To"] = "feedback@yourdot.com";
  7. $headers["Subject"] = "User feedback";
  8. $mailmsg = "Hello, This is a test.";
  9. /* SMTP server name, port, user/passwd */
  10. $smtpinfo["host"] = "smtp.mycorp.com";
  11. $smtpinfo["port"] = "25";
  12. $smtpinfo["auth"] = true;
  13. $smtpinfo["username"] = "smtpusername";
  14. $smtpinfo["password"] = "smtpPassword";
  15. /* Create the mail object using the Mail::factory method */
  16. $mail_object =& Mail::factory("smtp", $smtpinfo);
  17. /* Ok send mail */
  18. $mail_object->send($recipients, $headers, $mailmsg);
  19.  
Reply