farhankhan Posted February 26, 2017 Share Posted February 26, 2017 I am trying to send email in hotmail inbox, every thing works fine but email goes in the junk folder of hotmail. I want to send the email in the inbox. In addition with, it works fine in case of gmail, msn and yahoo. here is my code: <?php if(isset($_POST['done']) ) { $name = $_POST['xclient']; $phoneno = $_POST['xphoneno']; $clemail = $_POST['xclemail']; $jouneytype = $_POST['xjouneytype']; $pickup = $_POST['xpickup']; $dropof = $_POST['xdropof']; $jobdate = date('d-m-Y', strtotime($_POST['xjobdate'])); $jobtime = $_POST['xjobtime']; $enddate = date('Y-m-d', strtotime($_POST['xenddate'])); $endtime = $_POST['xendtime']; $to = $_POST['xdrvmail']; $Cc = "myaddress@example.com"; // Multiple recipients // Subject $subject = ' ORDER DETAILS - ECL-WORLDWIDE'; // Message $message = " <html> <head> <title>Order Details</title> </head> <body> <table> <tr> <td><b>Client Name</b></b></td><td>$name</td> </tr> <tr> <td><b>Contact No</b></td><td>$phoneno</td> </tr> <td><b>Pickup Location</b></td><td>$pickup </td> </tr> <tr> <td><b>Drop of Location</b></td><td>$dropof</td> </tr> <tr> <td><b>Job Date</b></td><td>$jobdate</td> </tr> <tr> <td><b>Job Time</b></td><td>$jobtime</td> </tr> <tr> <td><b>Completion Date</b></td><td>$jobdate</td> </tr> <tr> <td><b>Completion Time</b></td><td>$jobtime</td> </tr> </table> </body> </html> "; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; $headers .= "Cc: $Cc" . "\r\n"; $headers .= "From: ECL-Worldwide <myaddress@example.com>" . "\r\n" . "Reply-To: myaddress@example.com" . "\r\n" . "X-Mailer: PHP/" . phpversion(); mail($to, $subject, $message, $headers); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/303300-email-is-not-going-in-hotmail-inbox/ Share on other sites More sharing options...
Jacques1 Posted February 26, 2017 Share Posted February 26, 2017 The code has plently of problems. First off, you're allowing anybody to send almost arbitrary content (read: spam) to arbitrary addresses without any restriction. That's certainly a good way to get yourself blacklisted. Then you're using the lame mail() function which sends the e-mails straight from the webserver. That's usually a bad idea. Unless the server is managed professionally (which I doubt), it probably doesn't have anything like a proper SPF record or DKIM to tell the world that it is in fact authorized to send e-mails for this domain. And it may already be blacklisted due to prior abuse. Last but not least, your e-mails are full of XSS vulnerabilities, which is even worse than spam and another good reason to reject your stuff. There's definitely a lot to learn and do before this is ready for production. Never ever let random visitors send out e-mails uncontrolledly. There should be a registration procedure for the sender or, if that isn't possible, a good CAPTCHA. A rate limit also helps avoid obvious abuse. Never ever let users put random content into e-mails. Always validate and escape the input. Use a proper library like PHPMailer instead of this mail() crap. Make sure to send the e-mails from an authorized machine. If you have an external mail server for your domain, use that. Quote Link to comment https://forums.phpfreaks.com/topic/303300-email-is-not-going-in-hotmail-inbox/#findComment-1543413 Share on other sites More sharing options...
farhankhan Posted February 27, 2017 Author Share Posted February 27, 2017 thanks for your guidance. I try to remove the issues which you said. Quote Link to comment https://forums.phpfreaks.com/topic/303300-email-is-not-going-in-hotmail-inbox/#findComment-1543447 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.