kono Posted June 26, 2003 Posted June 26, 2003 Hello, Since the difficulties on Server 24 earlier this week, people have encountered a pesky problem when posting to my site's phpBB board. I've finally pinned down the source of the problem, and it is this: Whenever someone posted a reply to a thread, and as a result, someone would receive a reply notification email, if that email would go to certain domains, php's mail() call would fail. The domains I've had problems with are hotmail.com, yahoo.com, msn.com, and aol.com. As you can imagine, that's a lot of my userbase. After some digging around, I noticed my phpNuke site has a backlog of new user registrations pending activation. Not surprisingly, each of those pending users had an email address from one of the four domains I've mentioned. In the past 24 hours, I've got 10 people who have signed up, but can't get the email which activates their accounts. I have had users successfully register, but their email domains were not one of the big four. I realize I can't ask for help debugging 3rd-party scripts, but I don't think that is where the problem lies. Have any changes been made recently which would prevent my domain from using php's mail() function to email certain domains? kono Quote
TCH-Andy Posted June 26, 2003 Posted June 26, 2003 (edited) I havn't looked at the mail() function within phpBB, but this is usually due to not having the right headers on the mail script. I usually stick the lot in, for example $myname = "my name"; $myemail = "me@myaccount.com"; $contactname = "someone else"; $contactemail = "someone@theiraccount.com"; $subject = "subject matter"; $message .= "Test message\n"; $headers .= "From: $myname <$myemail>\r\n"; $headers .= "Reply-To: $myname <$myemail>\r\n"; $headers .= "To: $contactname <$contactemail>\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: PHP Mailer\n"; mail($contactemail, $subject, $message, $headers); This seeems to work fine. However, if you miss out some of the headers the accounts such as Hotmail don't always seem to like it. Andy Edit: Opps - there were a couple of mistakes in that code (it was late last night!!!) I've corrected it. Edited June 27, 2003 by AndyB Quote
kono Posted June 26, 2003 Author Posted June 26, 2003 The thing is, this all used to work. I hadn't changed something to make it stop working. The problems on Server 24 happened right before these errors were reported. I read that the server had its kernel updated, so I'm wondering if something in the environment changed. Perhaps some php constant was altered? Just for yuks, I tried the snippet you posted. However, I replaced the last line with: >$result = mail($contactemail, $subject, $message, $headers); if ($result) echo "mail sent to $contactemail"; else echo "mail NOT sent to $contactemail"; I set $contactemail to a hotmail account I created, and $myemail (and $myreplyemail) to a working account on my domain. I get the error condition, and no mail arrives in my hotmail inbox. kono Quote
TCH-Andy Posted June 26, 2003 Posted June 26, 2003 Drop a ticket in at the helpdesk and we'll have a look at the server side of things. Andy Quote
kono Posted June 26, 2003 Author Posted June 26, 2003 Update: It now appears both my site and the test script above are failing to send mail to any domain, not just the big 4 I mentioned. I don't know how long that has been the case. kono Quote
imadsurfer Posted June 26, 2003 Posted June 26, 2003 I have been having the same problem for the past 2 days. I thought it was something that I was doing, but now I'm not so sure... ImaD Quote
TCH-Rick Posted June 27, 2003 Posted June 27, 2003 Please check it out and see if things are working correctly now. I think the problem is fixed. Both of you are on server 24 so hopefully things are back to normal. Quote
imadsurfer Posted June 27, 2003 Posted June 27, 2003 Thanks Rick..I'll check it out today and let you know..... Thanks again, ImaD Quote
surefire Posted June 27, 2003 Posted June 27, 2003 One way to know for sure if there is a probelm is to load up a test page with a script like <?php mail("you@yoursite.com", "test", "test"); ?> If you have a yahoo account, then you could test this too. It is known that hotmail will often need the full headers in order to work. There is info on this issue at php.net Quote
imadsurfer Posted June 28, 2003 Posted June 28, 2003 So far it seems to be working fine again... woo hoo Thumbs Up ImaD Quote
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.