I ve created an ecard thing for my site but if the ecard is sent to a hotmail account it automatically goes straight to the junk mail folder.. and also the image within the email doesnt seem to show…. it all works fine if sent to an outlook express
here the code im using to automatically send a email to notify the person they have an ecard.
[code=php]<?php
// set variables for access
$host = “localhost”;
$user = “xxx”;
$password = “xxx”;
$dbname = “xxx”;
$tablename = “ecard”;
// these headers are for the purpose of sending the email replay to hotmail and yahoo addresses
$headers = “MIME-Version: 1.0rn”;
$headers .= “Content-type: text/html; charset=iso-8859-1rn”;
$headers .= “From: Heavydays E-cards <[email protected]>rn”;
$headers .= “Reply-To: <[email protected]>rn”;
$headers .= “X-Priority: 3rn”;
$headers .= “X-MSMail-Priority: Normalrn”;
$headers .= “X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409rn”;
$headers .= “X-Mailer: Microsoft Outlook Express 6.00.2800.1409”;
// connect to database
$link = mysql_connect ($host, $user, $password);
mysql_select_db ($dbname, $link);
// creates a random number for the id, ans check to see if the random number currently exists in database
$success = FALSE;
while($success == FALSE) {
$rand = rand(100000, 999999);
$q = “SELECT * FROM $tablename WHERE id = ‘$rand'”;
$r = mysql_query($q, $link);
echo mysql_error();
if(mysql_num_rows($r)) { //id exists
continue;
} else {
$success = TRUE;
}
}
// insert your data here with $rand as the id
$query = “INSERT into $tablename values (‘$rand’, ‘$youremail’, ‘$receiveremail’, ‘$message’)”;
$result = mysql_query($query, $link);
if (!$result) {
echo “Query Failed: ” . mysql_error() . “<br />n”;
exit;
}
$eid = $rand;
mysql_close ($link);
// this send the receiver an email with the link to their ecard
mail(“$receiveremail”,”youve received an ecard !”, “<img src=’http://www.popcop.co.uk/ecards/logo.gif’ width=’149′ height=’48’>
</p>
<p>Hello there,</p>
<p>Someone you know has sent you a secret message from popcop.co.uk </p>
<p>You can view your message here : <a href=’http://www.popcop.co.uk/ecards/viewcard.php?id=$eid’>[url]http://www.popcop.co.uk/ecards/viewcard.php?id=[/url]$eid</a><br>
Cheers,<br>
Heavydays”, $headers);
?>
</body>
</html>