Jump to content

Recommended Posts

Posted

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

Posted (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 by AndyB
Posted

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

Posted

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

Posted

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.

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...