/    Sign up×
Community /Pin to ProfileBookmark

How can i prevent hotmail junk folder & how can i get image to show in php email

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>
[/code]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogFeb 03.2005 — It may not be anything to do with your code, but rather your web host provider. It's IP address may be "black-listed" by Hotmail due to a number of users with accounts there that have been used to send spam. Just a guess, though.
Copy linkTweet thisAlerts:
@popcopauthorFeb 03.2005 — what about the image that doesnt show in the mail when viewed in hotmail but is fine in outlook
Copy linkTweet thisAlerts:
@NogDogFeb 03.2005 — [i]Originally posted by popcop [/i]

[B]what about the image that doesnt show in the mail when viewed in hotmail but is fine in outlook [/B][/QUOTE]

I'll have to leave that to those who know more about SMTP and email. ?
Copy linkTweet thisAlerts:
@dreesemonkeyFeb 03.2005 — Have you tried escape characters on the <img> tag's single quotes? I usually use double quotes for everything...

[code=php]
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'><a href="http://www.popcop.co.uk/ecards/viewcard.php?id=" target="_blank">http://www.popcop.co.uk/ecards/viewcard.php?id=</a>$eid</a><br>
Cheers,<br>
Heavydays", $headers);
[/code]


I have no idea, it's just a guess, but perhaps worth a shot.
×

Success!

Help @popcop spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...