|
Hotmail doesn't like PHP mail
You've got MMm...Or not |
iJeep Full Member


 joined:Nov 30, 2002 posts:202
#:1298484
| 7:19 pm on Dec. 13, 2002 (utc 0) |
I cannot get hotmail to accept mail messages using mail() without it
moving it to the Bulk Mail folder. I read at the php.net site that I
needed to include the To: information in headers, but that doesn't seem
to be working either. Here is my code: $message = "Hello $tname,<br> $fname has requested that you take a look at the:<br> <strong>$part</strong><br> available from WidgetWorld</a> at:<br> WidgetURL <br> Thank You,<br> WidgetWorld"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: Widgets.com <web@Widgets.com>\r\n"; $headers .= "To: ".$tname." <".$temail.">\r\n"; $headers .= "Reply-To: Widgets.com <web@Widgets.com>\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: Widgets.com Server"; mail($temail, "From: $fname, To: $tname - $part", $message, $headers);
|
transistor Junior Member


 joined:May 2, 2002 posts:141
#:1298485
| 8:12 pm on Dec 13, 2002 (utc 0) |
Hello iJeep (cool nickname!) Ok, the mail function works like this: mail ($to, $subject, $message, $headers)
$to = "someone <some@email>"; $subject = "You've got mail!"; $message = "Hello someone."; $headers = "From: me@mysite.com\n"; // I suggest you try using only \n $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; $headers .= "Reply-To: me <me@mysite.com>\n"; $headers .= "X-Priority: 1\n"; $headers .= "X-MSMail-Priority: High\n"; $headers .= "X-Mailer: My mailer";
Although
probably Hotmail believes that your message is spam because of
something else, maybe the text you use in the message triggers the spam
filters. Hope this helps, good luck!
|
andreasfriedrich Senior Member


 joined:July 22, 2002 posts:1776
#:1298486
| 11:38 pm on Dec 14, 2002 (utc 0) |
| I suggest you try using only \n |
| I suggest you stick with the standards and use CRLF instead of only \n (RFC1425, RFC822). 3.1.2. STRUCTURE OF HEADER FIELDS Once
a field has been unfolded, it may be viewed as being composed of a
field-name followed by a colon (":"), followed by a field-body, and
terminated by a carriage-return/line-feed. |
| Andreas
|
iJeep Full Member


 joined:Nov 30, 2002 posts:202
#:1298487
| 12:08 am on Dec 15, 2002 (utc 0) |
I used the method in mesage 2 and it worked. May have just been because It got rid of the second "To:" field. Thanks for the help
|
andreasfriedrich Senior Member


 joined:July 22, 2002 posts:1776
#:1298488
| 12:21 am on Dec 15, 2002 (utc 0) |
transistor´s advice was great. A lot of people are lazy and use just \n
and a lot of SMTP implementations accept that. I was just trying to
raise awareness of what the standards suggest. As
soft laws you are not required to follow standards. There is no
immediate sanction. If you decide not to follow them, you are barred
from complaining that something´s not working. | Many people and even experienced people, do not even realize what a standard is or can do for them. |
| Brett on "Posting Code" Quoting standards again ;) Andreas
|
bird Senior Member


 joined:Aug 10, 2001 posts:1490
#:1298489
| 12:33 am on Dec 15, 2002 (utc 0) |
Note
that the '\r\n' standard is only really relevant for SMTP connections.
In this case here, the documentation of the PHP mail() function will
tell you whether it converts single newlines for you automatically (as
every decent library mail function should do), or if you need to
include the full brass yourself.
|
andreasfriedrich Senior Member


 joined:July 22, 2002 posts:1776
#:1298490
| 12:58 am on Dec 15, 2002 (utc 0) |
I hadn´t even considered that this could be PHP´s job. But as it stands PHP won´t help you: | You must use \r\n to seperate headers, although some Unix mail transfer agents may work with just a single newline (\n). |
| http://www.php.net/manual/en/function.mail.php To be on the save side you should use \x0d\x0a instead of the logical \r\n (http://www.webmasterworld.com/forum13/1561.htm#msg7). Andreas
|
transistor Junior Member


 joined:May 2, 2002 posts:141
#:1298491
| 2:21 am on Dec 15, 2002 (utc 0) |
Glad it worked iJeep. andreasfriedrich, you are absolutely right, one must stick to the standards.
|
|
|
|
|