php mail() in Hotmail junk, please help

Hi,
It´s been a while since i´m trying to get out of the hotmail junk.
I have searched in a lot of places but i haven´t found nothing that works, i´ll be much grateful if someone helps me. I need to lunch this site today 00:00.
So far i have this:
        $mail_envia = "someone@hotmail.com";
      $mail_admin = "email@mydomain.com";
      $assunto = "Text";
      $assunto = "=?UTF-8?B?".base64_encode($assunto)."?=";
      
      $headers = "From: mydomain <$mail_admin>\r\n";
      $headers .= "Bcc: <$mail_envia>\r\n";
      $headers .= "Reply-To: $mail_admin\r\n";
      $headers .= "X-Sender: <$mail_admin>\r\n";
      $headers .= "Return-Path: <$mail_admin>\r\n";
      $headers .= "MIME-Version: 1.0\r\n";
      $headers .= "Content-Type: text/html; charset=UTF-8\r\n";
      $headers .= "Content-Transfer-Encoding: 7bit\r\n";
      $headers .= "Date: ".date("D, d M Y H:i:s") . " UT\r\n";
      $headers .= "Message-ID: <".sha1(microtime())."@mydomain.com>\r\n";
      $headers .= "X-Mailer: PHP5\r\n";
      $headers .= "X-Priority: 3\r\n";
      
      $mensagem = "<table cellspacing='0' cellpadding='0' border='0' bgcolor='#f8eed8' width='756px'>
                              <tr>
                                    <td width='756px' height='100px' colspan='2' align='center'>
                                          <font size='5px'>
                                                TEXT
                                          </font>
                                    </td>
                              </tr>
                              <tr>
                                    <td width='196px' height='446px' align='center'>
                                          <font size='6px' color='#7e6845'>
                                                <b>
                                                      TEXT
                                                </b>
                                          </font>
                                    </td>
                              </tr>
                        </table>
                        <table cellspacing='0' cellpadding='0' border='0' width='756px'>
                              <tr>
                                    <td align='center' height='50px' width='756px'>
                                          TEXT
                                    </td>
                              </tr>
                        </table>";
      if(mail(null,$assunto,$mensagem,$headers,"-f $mail_admin")) {
            #Do something;
      } else {
            #Do something;
      }
pep477Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
The only thing that works with Hotmail is your reputation for your email address.  Nothing else will get you delivered to the Inbox.  They are more concerned with blocking spam than with delivering email... since they get much more spam than legitimate email.  Even a simple plain text email from many addresses will be marked suspicious and anything that is web-server generated almost always is.  Here is their troubleshooting page:  http://mail.live.com/mail/troubleshooting.aspx

I just noticed that you put a 'null' for the 'to' address in you post.  ??

I would eliminate these lines:
$headers .= "Date: ".date("D, d M Y H:i:s") . " UT\r\n";
      $headers .= "Message-ID: <".sha1(microtime())."@mydomain.com>\r\n";
      $headers .= "X-Mailer: PHP5\r\n";
      $headers .= "X-Priority: 3\r\n";

Open in new window

Date-time and message id are set by the SMTP server and you may duplicating them.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
designatedinitializerCommented:
I would try to send that email through SMTP.
First create a proper email account on your server, then use a PHP library with SMTP support, like a class I use called XMimeMail.
You can find it online, and it is pretty straightforward to use.

But be prepared to face the fact that Hotmail may still dump your emails to the junk folder.
You will have to advise the receivers that your emails may end up in the junk folder, and they should put your sender email address in the list of known senders. That's the only way to guarantee it won't happen.
0
pep477Author Commented:
Thank you for your replie, i was waiting for something like that, i knew it was strange after all my research nobody could do that with the mail() function of php, but thanks.
0
Dave BaldwinFixer of ProblemsCommented:
For what it's worth, this is my PHP Email demo using the mail() function.  I have no trouble sending to my Hotmail account with it but the last time, it marked it as 'Suspicious'.

<?php
error_reporting(E_ALL);
ini_set('display_errors','On');

# some settings of POST vars
if (!isset($_POST['send']))  $send = ''; else $send = $_POST['send'];
if (!isset($_POST['toText'])) $toText = ''; else $toText = $_POST['toText'];
if (!isset($_POST['ccText'])) $ccText = ''; else $ccText = $_POST['ccText'];
if (!isset($_POST['subjectText'])) $subjectText = ''; else $subjectText = $_POST['subjectText'];
if (!isset($_POST['msgText'])) $msgText = ''; else $msgText = $_POST['msgText'];
if (!isset($_POST['ccText'])) $ccText = ''; else $ccText = $_POST['ccText'];
if (!isset($_POST['bccText'])) $bccText = ''; else $bccText = $_POST['bccText'];
if (!isset($_POST['nameText'])) $nameText = ''; else $nameText = $_POST['nameText'];
if (!isset($_POST['fromText'])) $fromText = ''; else $fromText = $_POST['fromText'];

if ($send == "") {
    $title="Test Email Page";
    $announce="---";
}
else {
	if($fromText === "") die("No name!");
  $toText="youremail@yourdomain.com";
	$title="Test Email Page";
  $announce="Your Message has been Sent!";
	$header = "From: ".$fromText."\r\n";
//	$header .= "Cc: ".$ccText."\n";
	$header .= "Reply-To : ".$fromText."\r\n";
	$header .= "Return-Path : ".$fromText."\r\n";
	$header .= "X-Mailer: PHP\r\n";
	$header .= "MIME-Version: 1.0\r\n";
	$header .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
//	ini_set(sendmail_from,$fromText);  
	mail($toText, $subjectText, $msgText, $header, '-f'.$fromText);
//	ini_restore(sendmail_from);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo($title)?></title>
<style type="text/css">
<!-- 
A:link { color: #999999; }
A:visited { color: #999999; }
A:hover {color: #0099ff;}
-->
</style>
<script type="text/javascript">
<!--
function check()
{
var at=document.getElementById("fromText").value.indexOf("@");
var eml=document.getElementById("fromText").value;
var nam=document.getElementById("nameText").value;
var alerttxt="";
var submitOK="true";

if (eml.length < 5 || at == -1)
    {
    alerttxt=alerttxt+"Please enter a valid e-mail address!\r\n";
    submitOK="false"
    //return false;
    }
if (nam.length < 3)
    {
    alerttxt=alerttxt+"Please enter your name.\r\n";
    submitOK="false"
    //return false;
    }
if (submitOK=="false")
    {
    alert(alerttxt);
    return false;
    }

}
// -->
</script>
</head>

<body bgcolor="#ddeedd">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" summary="" width="580">
<tr><td align="center">

<?php
if ($send != "") {
   	echo ("To: ".$toText."<br>\r\nSubject: ".$subjectText."<br>\r\n".$msgText."<br>\r\n".$header);
		}
?>

<p><b><font color="#000000" size="5">Test Email</font></b></p>
<font size="4" color="#000000">

<form method="POST" action="Email.php" onsubmit="return check();">
    <p><font size="3"><b>Name: <input type="text" name="nameText" id="nameText" size="46"></b></font></p>
    <p><font size="3"><b>Email: <input type="text" name="fromText" id="fromText" size="46"></b></font></p>
    <input type="hidden" name="subjectText" value="Web Mail">
    <p><font face="Arial" size="3"><b>Message Text:</b></font></p>
    <p><font face="Arial" size="3"><b><textarea rows="6" name="msgText" cols="60"></textarea></b></font></p>
    <p><font size="3"><b><input type="submit" value="Send" name="send" style="font-family: Arial; font-size: 12pt; font-weight: bold"></b></font></p>
    <input type="hidden" name="state" value="1">
  </form>
  <b><font face="Arial" size="4" color="#e00000"><?php echo($announce)?></font></b><br><br>

</font>
</td></tr>
</table> 
</div>


</body>
</html>

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.