Hey guys,
I know this has been asked before, and I used the example from the one that looked like it actually worked. Take a look at my code:
<?php
$to = $_POST['forgot'];
$dbh=mysql_pconnect ("******", "****", "****") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("*****"); //Connect to mysql
$result = @mysql_query("SELECT Username, PASSWORD FROM identify WHERE Email='$to'");
while ( $row = mysql_fetch_array($result) ) {
$user = $row['Username'];
$pass = $row['PASSWORD'];
}
$myname = "chaseschwalbach.com Admin";
$myemail = "admin@chaseschwalbach.com";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$user." <".$to.">\r\n";
$headers .= "Reply-To: ".$myname." <".$myemail.">\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";
$body = " <html><body>
<p>Here are your login details for chaseschwalbach.com. Please remember these for future use. </p>
<p>Login Username: ".$user."</p>
<p>Login Password:".$pass."</p>
<p> </p>
<p>If you need further assistance you can contact me anytime at [email]admin@chaseschwalbach.com[/email]. </p>
<p> </p>
<p>Best Wishes,</p>
<p>chaseschwalbach.com admin </p>
</body>
</html> ";
$subject = "Password recovery from chaseschwalbach.com";
$mail=@mail($to, $subject, $body,$headers);
if(!$mail){
echo "&forgot = Email not sent! Please try later...";
}else{
echo "Mail sent successfully! Thank you";
}
?>
Ok, before anyone says it must be my variables: I set my mysql database username to a different email, and I got that email, it had the $user and $pass correct, and sent to the correct address($to) It even forwards this email to hotmail(because it auto-forwards everything to hotmail) and that was fine. I just cannot send it directly to hotmail.
What am I doing wrong!?!?
Thank you guys so much 🙂
Chase