Langdon
asked on
PHP mail() problem
I've been having a problem with the PHP mail() function recently...
The syntax and everything is fine and I can send mail to some addresses no problem.
The problem is when it comes to hotmail addresses. I have tried mail()ing to a hotmail address and nothing showed up.
I've mailed to my home address (POP3) and to other web based services with no problem whatsoever, but when I mail to a hotmail address nothing seems to arrive in the inbox. Has anyone else had a problem with this?
Any help would be great. I am going to try to mail() to a different hotmail address and see what happens.
Thank
-Langdon
The syntax and everything is fine and I can send mail to some addresses no problem.
The problem is when it comes to hotmail addresses. I have tried mail()ing to a hotmail address and nothing showed up.
I've mailed to my home address (POP3) and to other web based services with no problem whatsoever, but when I mail to a hotmail address nothing seems to arrive in the inbox. Has anyone else had a problem with this?
Any help would be great. I am going to try to mail() to a different hotmail address and see what happens.
Thank
-Langdon
strange problem...
pls put your code here...
problem can this also...few days back hotmail was slow and reaching mail out there was taking hell lot of time....
second may be hotmail account may be full....
regards
pls put your code here...
problem can this also...few days back hotmail was slow and reaching mail out there was taking hell lot of time....
second may be hotmail account may be full....
regards
the problem might be because of hotmails spam block:
try this:
-------------------------- ----------
<?php
$myname = "Me Myself";
$myemail = "myself@email.com";
$contactname = "Mister Contact";
$contactemail = "contact@email.com";
$message = "hello from happy me";
$subject = "A mail not refused by Hotmail";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$contactname." <".$contactemail.">\r\n";
$headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";
mail($contactemail, $subject, $message, $headers);
?>
-------------------------- ----------
try this:
--------------------------
<?php
$myname = "Me Myself";
$myemail = "myself@email.com";
$contactname = "Mister Contact";
$contactemail = "contact@email.com";
$message = "hello from happy me";
$subject = "A mail not refused by Hotmail";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$contactname." <".$contactemail.">\r\n";
$headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";
mail($contactemail, $subject, $message, $headers);
?>
--------------------------
Do you use a specific class or function for testing email address validity before sending ? You could have some trouble with this kind of function.
ASKER
The funny thing about this is... I created a different email address at hotmail and it worked fine....
I am thinking that it's hotmail's problem not mine. I have checked and there is lots of room in the mailbox and tghe spam filter is off. Hmm I am going to try and email it again to the first address...
Thanks
I am thinking that it's hotmail's problem not mine. I have checked and there is lots of room in the mailbox and tghe spam filter is off. Hmm I am going to try and email it again to the first address...
Thanks
it's easy to see.
if you have full access on your server check the mail logfile (usually in /var/log).
Here you will see if the mail has been sent or refused.
if you have full access on your server check the mail logfile (usually in /var/log).
Here you will see if the mail has been sent or refused.
I've had the same problem. Jonza is probably right and it is the spam block. However for me these headers were enough:
$headers = "From: $myname<$myemail>\n";
$headers .= "Reply-To: <$myemail>\n";
$headers .= "X-Sender: <$myemail>\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <$myemail>\n";
$headers .= "Content-Type: text/html; charset=windows-1251\n";
mail($email, $subject, $message, $headers);
Also it seems that 'From' and 'Reply-To' addresses must be valid emails, as some servers check for fakes.
Another problem that i encountered - even though I did set the encoding to win-1251 (Russian) whenever i was sending an email with Subject line in cyrillic the hotmail would take it as spam.
Regards
$headers = "From: $myname<$myemail>\n";
$headers .= "Reply-To: <$myemail>\n";
$headers .= "X-Sender: <$myemail>\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <$myemail>\n";
$headers .= "Content-Type: text/html; charset=windows-1251\n";
mail($email, $subject, $message, $headers);
Also it seems that 'From' and 'Reply-To' addresses must be valid emails, as some servers check for fakes.
Another problem that i encountered - even though I did set the encoding to win-1251 (Russian) whenever i was sending an email with Subject line in cyrillic the hotmail would take it as spam.
Regards
Did my solution work for you or is there anything else I can help with?
Did any of this help you? If so, please award a grade to close this question.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
Delete with points refunded
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
snoyes_jw
EE Cleanup Volunteer
I will leave the following recommendation for this question in the Cleanup topic area:
Delete with points refunded
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
snoyes_jw
EE Cleanup Volunteer
I think there is some good information in the replies that should be preserved. I don't care if you give me points or not, but do recommend not killing the Q.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
mail($mailto, $subject, $message,
"From: " . $frommail . "\r\n"
."Reply-To: " . $frommail . "\r\n"
."X-Mailer: PHP/" . phpversion());