
My mail is treated as spam. Kindly help
I'm accepting some registration and mailing to the user about registration. But the mail sent is being treated as spam in gmail (checked only in that). I've changed my domain name to mySite.com in the below code. I dont own or have rights to mySite.com or the below code is not from mySite.com
Code:
<style>
body{
color:#FBFBEF;
font-family:Verdana, Georgia, Arial;
}
</style>
<html>
<body>
<?php
$con=mysql_connect('localhost', 'username', 'password');
if (!$con){
die('Connection error... Try Again Later');
}
mysql_select_db('dbName',$con);
$count = mysql_query("SELECT * FROM idCount");
$row = mysql_fetch_assoc($count);
$count=(int) $row['count'];
$count++;
$key="ky".$time."lk".$count.time()."9875grk";
$id="USR_";
if($count<10) $id.="000".$count;
else if($count<100) $id.="00".$count;
else if($count<1000) $id.="0".$count;
else $id.=$count;
$username = $_POST['usrname'];
$pars = $_POST['parsword'];
$name = $_POST['name'];
$email = $_POST['email'];
$ph = $_POST['ph'];
$address = $_POST['address'];
$year = $_POST['year'];
$college = $_POST['college'];
$passsalt=modified password;
$preCount=$count-1;
mysql_query("UPDATE idCount SET count='$count' where count='$preCount'");
echo "Your ID='$id'.
";
$sql="INSERT INTO verification (id,username,passSalt, name, email, phone, year,
college, address, rkey)
VALUES('$id','$username','$passsalt','$name','$email','$ph','$year','$college','$address','
$key')";
if (!mysql_query($sql))
die('Error: ' . mysql_error());
$to = $email; // note the comma
// subject
$subject = 'mySite 2010 Registration';
// message
$message = "
<html>
<body bgcolor='#000000' text='#ffffff' LINK='#ffffff' VLINK='#B6B6B6' ALINK='#B6B6B6'
>
<img src='http://mySite.com/main/images/emailHeader.gif' alt='mySite 2010' width='800' height='200'>
Dear $name,
You have been registered in <a
href='http://mySite.com'>http://mySite.com</a> with this e-mail ($email) and the
following details
<table>
<tr><td>ID</td><td>$id</td></tr>
<tr><td>Username</td><td>$username</td></tr>
<tr><td>Phone no</td><td>$ph</td></tr>
<tr><td>Year</td><td>$year</td></tr>
<tr><td>College</td><td>$college</td></tr>
<tr><td>Address</td><td>$address</td></tr>
</table>
To confirm this e-mail and registration kindly click (or copy paste) below
link
----------------------------------------------------------------------------------------------
<a href='http://mySite.com/main/#confirmMail.php?key=$key'>
http://mySite.com/main/#confirmMail.php?key=$key </a>
----------------------------------------------------------------------------------------------
If the e-mail is by some mistake, kidle click (or copy paste) below link
----------------------------------------------------------------------------------------------
<a href='http://mySite.com/main/#unconfirmMail.php?key=$key'>
http://mySite.com/main/#unconfirmMail.php?key=$key </a>
----------------------------------------------------------------------------------------------
</body>
</html>
";
// To send HTML mail, the Content-type header must be set
$headers = "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
// Additional headers
$headers .= "From: mySite 2010 <info@mySite.com> \r\n";
// Mail it
mail($to, $subject, $message, $headers,"-fmySite.com");
echo "Registration Successfull... Verify Your <b>E-mail</b> to complete Registration....";
mysql_close($con);
?>
</body>
</html>