guvenck
03-09-2007, 01:21 PM
Hi,
When I investigated a site I've built, I've found out that nearly half of the users did not activate their account. I've digged deeper and found out almost %90 of these non-activated users had applied for an account through their hotmail account.
It is obvious that hotmail users can't receive the activation mails I've sent through PHP mail function and therefore can't activate their accounts.
But, I also have activated users -not that many- with hotmail accounts. So, sometimes the mail goes through.
I've found on the net that many people had this problem.
This is a big problem as my client is asking me why this happens. Before I put the %100 blame to hotmail, I'd like to know if there is anything I can do to improve or guarantee to be accepted by the glorious MS Hotmail.
Here is my code, although I don't think anything is wrong. Yahoo or Gmail have no difficulties receiving this email.
$headers = "";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Return-Path: <system@myclientsdomain.com>\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
$headers .= "X-Mailer: PHP/" . phpversion() . "\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority: Normal\r\n";
$headers .= "From: My Client <system@myclientsdomain.com>\r\n";
$headers .= "To: $name $surname <$email>\r\n\r\n";
$subject = "Your Activation";
$message = "";
$message .= "<html><head><title></title>";
$message .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">";
$message .= "</head><body>";
$message .= "<p>Dear $name $surname,</p>";
$message .= "<p>Thanks for signing up to our website!<br>";
$message .= "One last step is needed to activate your account.<br>";
$message .= "<p>Please click on the link below to activate:</p>";
$message .= "<p><a href=\"http://www.myclientsdomain.com/activate.php?op=activate&confirm=$token\">http://www.myclientsdomain.com/activate.php?op=activate&confirm=$token</a></p>";
$message .= "<p>Thanks!<br>";
$message .= "My Client</p>";
$message .= "<p>This is an automated message, please do not reply.</p>";
$message .= "</body></html>";
if (@mail($email, $subject, $message, $headers)) {
include ("header.php");
?>
<table width="100%" cellspacing="8" cellpadding="8" border="0">
<tr>
<td valign="top">
<h2 align="center">Thanks...</h2>
<p>Dear <?php echo "$name $surname"; ?>,<br><br>An activation email has been sent to the email address you provided.<br>
Please click on the link in this email to activate your account.</p>
<p><b>ATTENTION:</b> Some free email providers (Hotmail, Yahoo, Gmail...) forward email messages to their "Bulk", "Junk", "Spam" folders.<br>
If you think you did not receive our activation email in your inbox, please check the folders mentioned above.</p>
<p>Thanks,<br>
My Client</p>
</td>
</tr>
</table>
<?php
include ("footer.php");
}
When I investigated a site I've built, I've found out that nearly half of the users did not activate their account. I've digged deeper and found out almost %90 of these non-activated users had applied for an account through their hotmail account.
It is obvious that hotmail users can't receive the activation mails I've sent through PHP mail function and therefore can't activate their accounts.
But, I also have activated users -not that many- with hotmail accounts. So, sometimes the mail goes through.
I've found on the net that many people had this problem.
This is a big problem as my client is asking me why this happens. Before I put the %100 blame to hotmail, I'd like to know if there is anything I can do to improve or guarantee to be accepted by the glorious MS Hotmail.
Here is my code, although I don't think anything is wrong. Yahoo or Gmail have no difficulties receiving this email.
$headers = "";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Return-Path: <system@myclientsdomain.com>\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
$headers .= "X-Mailer: PHP/" . phpversion() . "\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority: Normal\r\n";
$headers .= "From: My Client <system@myclientsdomain.com>\r\n";
$headers .= "To: $name $surname <$email>\r\n\r\n";
$subject = "Your Activation";
$message = "";
$message .= "<html><head><title></title>";
$message .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">";
$message .= "</head><body>";
$message .= "<p>Dear $name $surname,</p>";
$message .= "<p>Thanks for signing up to our website!<br>";
$message .= "One last step is needed to activate your account.<br>";
$message .= "<p>Please click on the link below to activate:</p>";
$message .= "<p><a href=\"http://www.myclientsdomain.com/activate.php?op=activate&confirm=$token\">http://www.myclientsdomain.com/activate.php?op=activate&confirm=$token</a></p>";
$message .= "<p>Thanks!<br>";
$message .= "My Client</p>";
$message .= "<p>This is an automated message, please do not reply.</p>";
$message .= "</body></html>";
if (@mail($email, $subject, $message, $headers)) {
include ("header.php");
?>
<table width="100%" cellspacing="8" cellpadding="8" border="0">
<tr>
<td valign="top">
<h2 align="center">Thanks...</h2>
<p>Dear <?php echo "$name $surname"; ?>,<br><br>An activation email has been sent to the email address you provided.<br>
Please click on the link in this email to activate your account.</p>
<p><b>ATTENTION:</b> Some free email providers (Hotmail, Yahoo, Gmail...) forward email messages to their "Bulk", "Junk", "Spam" folders.<br>
If you think you did not receive our activation email in your inbox, please check the folders mentioned above.</p>
<p>Thanks,<br>
My Client</p>
</td>
</tr>
</table>
<?php
include ("footer.php");
}