?
Solved

PHP mail() problem

Posted on 2003-03-02
12
Medium Priority
?
208 Views
Last Modified: 2008-03-17
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
0
Comment
Question by:Langdon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 7

Expert Comment

by:Big_Red_Dog
ID: 8053893
Make sure you include the From: and Reply-To: like this:

mail($mailto, $subject, $message,
     "From: " . $frommail . "\r\n"
    ."Reply-To: " . $frommail . "\r\n"
    ."X-Mailer: PHP/" . phpversion());
0
 
LVL 6

Expert Comment

by:carchitect
ID: 8055367
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
0
 
LVL 1

Expert Comment

by:Jonza
ID: 8055437
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);
?>
------------------------------------
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Expert Comment

by:us111
ID: 8057447
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.
0
 

Author Comment

by:Langdon
ID: 8058846
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
0
 
LVL 8

Expert Comment

by:us111
ID: 8058874
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.
0
 

Expert Comment

by:beauty_fool
ID: 8071115
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
0
 
LVL 7

Expert Comment

by:Big_Red_Dog
ID: 8071140
Did my solution work for you or is there anything else I can help with?
0
 
LVL 7

Expert Comment

by:Big_Red_Dog
ID: 8547297
Did any of this help you?  If so, please award a grade to close this question.
0
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 11934001
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
0
 
LVL 7

Expert Comment

by:Big_Red_Dog
ID: 11934406
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.
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 11975627
Submitted to PAQ with points refunded (50)

DarthMod
Community Support Moderator
0

Featured Post

Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question