Jump to content

Recommended Posts

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);
 
}
?>
 
 

 

Link to comment
https://forums.phpfreaks.com/topic/303300-email-is-not-going-in-hotmail-inbox/
Share on other sites

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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.