473,473 Members | 2,215 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

message sent to mail go to spam mail

123 New Member
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.  
Aug 27 '09 #1
6 4180
dlite922
1,584 Recognized Expert Top Contributor
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
Aug 27 '09 #2
hsriat
1,654 Recognized Expert Top Contributor
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)
Aug 31 '09 #3
simon2x1
123 New Member
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
Sep 14 '09 #4
labmonkey111
44 New Member
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.
Sep 14 '09 #5
zorgi
431 Recognized Expert Contributor
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
Sep 16 '09 #6
simon2x1
123 New Member
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.  
Oct 31 '09 #7

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

Similar topics

5
by: Philip Ronan | last post by:
OK, here's my 2p worth: === Q. Why am I getting the error message 'Headers already sent'? A. PHP produces this error message when you try to set a header for a web page after you have already...
2
by: Janna Deegan | last post by:
Hello all, First off, if there is a better place to post for an answer to this question, please feel free to point me there. I have some very strange behavior happening with my System.web.mail...
10
by: ahager via DotNetMonster.com | last post by:
I am receiving this messaage in a console application I wrote, I am authenticating, and my network admin swears their is nothing wrong with the smtp server. Any ideas? public void Mail_update()...
3
by: Jens | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send...
2
by: Martin | last post by:
Hi, I have standard code that sends mail from an asp.net application. The application is running on a production web server. it uses the standard system.web.mail namespace. most of the time...
4
by: chris.huh | last post by:
This may not be the best place to put this but i have set up apache as a testing server on my local machine. Whenever i try to use a formmail.php script i downloaded is always come sup saying that...
16
by: whyyyy | last post by:
The script below works fine if the form is filled out and submitted. But a (blank) e-mail is sent whenever the page loads, even when the form is not submitted. I would like to receive the e-mail...
0
by: Mail Delivery System | last post by:
--foo-mani-padme-hum-2391-1-1176705911 Content-Type: text/plain This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more...
2
by: =?Utf-8?B?c2Ft?= | last post by:
I use Outlook express 6 and run Macafee virus protection. When I check my email I have hundreds of replies telling me my sent messages were blocked by spam blockers or the recip address is not...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.