ibnclaudius Posted October 27, 2011 Share Posted October 27, 2011 The emails sent with mail() to Hotmail is ending in the Junk Mail, but with Gmail, Yahoo etc. is everything ok. I'm have problem only with hotmail. Why? Here is the code: <?php include('config.php'); $getUser_sql_not_sent = "SELECT * FROM emails WHERE sent = '0' LIMIT 10"; $getUser_not_sent = mysql_query($getUser_sql_not_sent); $getUser_num_not_sent = mysql_num_rows($getUser_not_sent); while ($row = mysql_fetch_array($getUser_not_sent)) { $boundary = uniqid('np'); $emailUser = $row['email']; $emailFrom = "faleconosco@campainha.com"; $emailSubject = 'A vida do profissional imobiliário ficou mais fácil'; $emailVerify = "http://www.campainha.com/verify.php?email=" . $emailUser; $boundary = uniqid('np'); $emailHeaders = "From: Campainha <" . $emailFrom . ">\r\n"; $emailHeaders .= "X-Mailer: PHP/" . phpversion() . "\r\n"; $emailHeaders .= "MIME-Version: 1.0\r\n"; $emailHeaders .= "Content-Type: multipart/alternative;boundary=" . $boundary . "\r\n"; $emailHeaders .= "Content-Transfer-Encoding: 8bit\r\n\r\n"; $emailBody = "\r\n\r\n--" . $boundary . "\r\n"; $emailBody .= "Content-type: text/html;charset=utf-8\r\n\r\n"; $emailBody .= "<a href = \"$emailVerify\"><img src = \"http://www.campainha.com/campainha.jpg\" alt = \"Campainha\" /></a>"; $emailBody .= "\r\n\r\n--" . $boundary . "--"; if (mail($emailUser, '=?UTF-8?B?'.base64_encode($emailSubject).'?=', $emailBody, $emailHeaders)) { mysql_query("UPDATE emails SET sent = '1' WHERE email = '$emailUser'") or die (mysql_error()); } } exit; ?> Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 27, 2011 Share Posted October 27, 2011 Different email servers use different criteria for detecting spam. It has nothing to do with using the mail() function. The spam filters look at things such as the headers of the email, the subject, and the message itself which includes the structure of the message. Does the message contain links and are they properly formatted, are there links to executables. Are there any "red flag" words in the subject or message. Words related to loans, penis/breast enlargement, Nigerian bankers, etc. etc. could be triggering the spam program. Also, the receiving email server may be doing a reverse lookup based on the "from" address. If you are sending an email as from "me@mydomain.com" but it is actually being sent from the email server myhostdomain.com that could be causing it. There are many things you can do to try and prevent your email from being flagged as spam. But, there are no guarantees. If the methods to circumvent spam filters was public knowledge those filters would become useless since every spammer would employ those methods Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.