tecmeister Posted February 18, 2010 Share Posted February 18, 2010 Hi Guys, I've set up a contact email form. It sends the information fine, but it sends it to the junk folder. If I just use this command: $headers = "MIME-Version: 1.0 \n"; It will send it to my inbox folder. If I use any other command after it in the $headers variable it will then send it to my junk folder. Here is the full code I'm using: $to = "[email protected]"; $subject = $title; $message = "<html><body>"; $message .= "<div style='border: 1px #ccc solid; padding: 5px; width: 100%; text-align: center'>"; $message .= "<b>Message From ". $name ."</b></div><br />"; $message .= "<div style='border: 1px #ccc solid; padding: 10px'>"; $message .= "Dear Emma,<br /><br />"; $message .= "<span>".$mess."</span></div>"; $message .= "</body></html>"; $headers = 'MIME-Version: 1.0' . "\n"; $headers .= "From: ".$name."<".$email.">\n"; $headers .= "Reply-To: ".$name."<".$email.">\n"; $headers .= "Return-Path: ".$name."<".$email.">\n"; $headers .= "cc: ". $name . "<".$email.">\n"; $headers .= "X-Mailer: Drupal\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" . "\n"; mail($to, $subject, $message, $headers); Thanks, tecmeister. Quote Link to comment https://forums.phpfreaks.com/topic/192533-mail-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 18, 2010 Share Posted February 18, 2010 The technically correct separator between each header is an \r\n Just a \n might be causing problems either at the sending mail server or at the receiving mail server. Quote Link to comment https://forums.phpfreaks.com/topic/192533-mail-problem/#findComment-1014437 Share on other sites More sharing options...
tecmeister Posted February 19, 2010 Author Share Posted February 19, 2010 I have already tried that and still got the same problem. Is there a basic $headers that you know of that will send the email directly to the inbox with the from info etc? Thanks for your help, tecmeister. Quote Link to comment https://forums.phpfreaks.com/topic/192533-mail-problem/#findComment-1014647 Share on other sites More sharing options...
PFMaBiSmAd Posted February 19, 2010 Share Posted February 19, 2010 "From: ".$name."<".$email.">\n" The From: address must be a valid email address at the sending mail server (or there must be an SPF record at the domain being used in the From: address that says that your mail server is authorized to send email for that domain.) Would you trust a letter you received from your credit card company with a From: address from within your country but a post mark saying it was mailed from a different country? Quote Link to comment https://forums.phpfreaks.com/topic/192533-mail-problem/#findComment-1014796 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.