homepage Welcome to WebmasterWorld Guest from 50.19.144.243
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Hotmail account not receiving mail
username




msg:4109970
 2:57 am on Apr 5, 2010 (gmt 0)

Hi all,

I have created a basic php mail application. The application sends to pop3 mailboxes successfully but even though the mail logs state a successful send/receive to a hotmail account, the mail does not arrive. Below is my code, and the mail log info:

/* PHP MAILER */
$to = "$email";
$subject = "Subject";
$message = "msg";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Event Dynamic <noreply@test.com>' . "\r\n";
mail($to, $subject, $message, $headers);


/* MAIL LOGS */
[root@host ~]# exigrep test@hotmail.com /var/log/exim_mainlog
2010-04-04 16:53:26 1NyXl0-000542-Rz test@hotmail.com R=lookuphost T=remote_smtp H=mx4.hotmail.com [65.55.37.120]
2010-04-04 16:53:27 1NyXl0-000542-Rz Completed

[root@host ~]#


Thanks in advance.

 

penders




msg:4110099
 12:04 pm on Apr 5, 2010 (gmt 0)

HotMail is a bit notorious in this respect. Is the email getting filtered as spam?

I've found I had to place the "MIME-Version" header at the end of the headers (or even omit it entirely!) for it to work OK with MS Outlook.

Matthew1980




msg:4110218
 5:17 pm on Apr 5, 2010 (gmt 0)

Hi there username,

$to = $email;//Why not just add the email var to the mail function direct? Easier & less code :)
$subject = "Subject";
$message = "msg";
$headers = "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: Event Dynamic <noreply@test.com>\r\n";
mail($to, $subject, $message, $headers);


Never a good idea to mix your quotes up when constructing a string ;-p

And I'm not sure why you were trying to add (concatonate) the \n\r with a . as these get interpreted as newline/carriage return characters when the mail is sent. You only need to use the . operand when joining vars, etc, when in php, or adding vars to echo strings. That's what I have always understood anyway:-

$someVar = "a value to print\n\r";
$someVar .= "More to add to the last string\n\r";
$someVar .= "Yet more to add\n\r";

echo $someVar; would just print:-

a value to print
More to add to the last string
Yet more to add


I have changed your version there now, though as the post by penders mentions about spam filters, you need to specify that messages from this address are not spam, just so that you can create a rule for it in future.

Hope that make sense;-p

Cheers,
MRb

rocknbil




msg:4110494
 4:20 am on Apr 6, 2010 (gmt 0)

..... with a . as these get interpreted as newline/carriage return characters when the mail is sent. You only need to use the . operand when joining vars, etc, when in php, or adding vars to echo strings.


In a command line mail application such as pine, etc., or when directly communicating with a mail program (e.g., not using mail(),) a bare period on a line by itself, like

print '.';

is an end of message indicator, telling the mail program to flush the buffer and send the mail.

THE PHP Exception, for Windblows servers [php.net]:


Caution

(Windows only) When PHP is talking to a SMTP server directly, if a full stop is found on the start of a line, it is removed. To counter-act this, replace these occurrences with a double dot.
<?php
$text = str_replace("\n.", "\n..", $text);
?>


Try running this, tell me what you get - or maybe you already know. :-)

<?php
header("content-type:text/html");
$verb="jumped";
$canine='dog';
echo "The quick " . ' brown fox ' . $verb . " over " . ' the ' . "lazy $canine" . '.';
?>

Although the quoting switches in the original code are indeed unnecessary, the effect of the two versions are synonymous.

In addition to Penders' suggestion (which may or may not help,) note that

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";


You are declaring the mail content-type as html, I have seen SpamAssassin flag points for (paraphrased) "content-type declared as html, no html found in message." So try

$message= "
<html><head><title>$subject</title></head></body>
<p>$message</p>
</body>
</html>
";

... before the send. Don't worry, the code won't appear in the email. It's not likely to help with hotmail, but you never know, it might, and does help on some recipient servers.

Make sure your SPF records are set up properly for the sending site . . . every little bit helps.

Also it may just be that your message is too short. I've no idea if that has anything to do with it, but put a few lines in there to make sure it's not being killed just because it's too close to an empty message.


Last stab, make sure the to and from are different domains, even this can trigger spam-boxing sometimes. That is, make the to from your gmail account, the from from your example.com account.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved