Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I created a website that occasionally emails users when they register/change their password/etc.

Every other person however cannot or does not receive the emails. They are telling me that they are not even hitting their spam folders.

I don't know a ton about MX records or email sending, but when I "Edit DNS Zone" for this domain in particular there is 1 MX record listed there.

How do you go about troubleshooting botched PHP mail actions?

UPDATE: Here is my super-simple php mailing code:

$subject = "Subject Here";
$message = "Emails Message";
$to      = $verified_user_data["email_address"];
$headers = "From: support@example.com\r\n" .
"Reply-To: support@example.com\r\n" .
"X-Mailer: PHP/" . phpversion();

//returns true on success, false on failure
$email_result = mail($to, $subject, $message, $headers);

re: "are you saying that some do and some do not?" @ Jacob

Yes, basically. I send the emails containing the user's login username/password using similar code above. And I sell to fairly tech-savvy people. About 50% of the time, my customers claim they cannot find their welcome emails in their inbox OR in their spam box. It's as if it never arrived. I have the largest problem with Yahoo email addresses accepting my emails or so it seems.

re: "The MX record at your end doesn't factor in, although the SPF record (or lack of it) will. How much access and control do you have on the server itself?" @ John Gardeniers

I rent a dedicated server from Codero. Running CentOS 5, WHM + cPanel. I have full root access to the entire thing. Don't know much about MX records and/or SPF records. I just want the PHP mail function to work. It doesn't say much about that on the php mail function's help page.

re: "What are you using for the SMTP server?" @ JonLim

No idea. I use the code above when I need to fire off an email to a loyal customer, and that's it. Do I need to be worrying about SMTP servers?

re: "Could be many, many things. Can you describe how you're sending mail in your code? i.e. are you relaying off of another mail server somewhere, using the local sendmail or postfix? Any consistency in domains that can/cannot receive email? Do you have a PTR record setup from the IP address that you're sending mail out as? What about SPF records?" @ gravyface

I just described my simple code above!

I believe I have been having the most trouble with Yahoo domains, however "independent" domains (probably running spamassasin) ex. client@clientsdomain.com as opposed to client@gmail.com seem to give a lot of trouble as well. I do not know if I have a PTR record setup from the IP address I'm sending my mail from. It's probably the same IP address that I setup my domain on, because I didn't do anything extra special. No idea about SPF records either, where can I go to create one?

Side Note: It's a crying shame what havoc the spammers have brought upon our beloved email system.

share|improve this question
    
are you saying that some do and some do not? –  Jacob Feb 14 '11 at 0:12
    
The MX record at your end doesn't factor in, although the SPF record (or lack of it) will. How much access and control do you have on the server itself? –  John Gardeniers Feb 14 '11 at 0:12
    
What are you using for the SMTP server? –  JonLim Feb 14 '11 at 19:24
    
login as root and grep /var/log/maillog for email addresses that didn't go through. There may be a 10-12 digit random number that you will want to then grep on. Forexample, the p1N6... in 'Feb 22 22:22:17 servername sendmail[9068]: p1N6MHsI009068: to=....' –  becomingwisest Feb 23 '11 at 7:59

1 Answer 1

up vote 1 down vote accepted

Could be many, many things. Can you describe how you're sending mail in your code? i.e. are you relaying off of another mail server somewhere, using the local sendmail or postfix? Any consistency in domains that can/cannot receive email? Do you have a PTR record setup from the IP address that you're sending mail out as? What about SPF records?

EDIT

I suspect that:

  • you're blacklisted somewhere. Plug your IP into MXToolbox's Blacklist checker and let us know the results. Could be that entire block that your server's on; perhaps a spammer was/is still there and if that's the case, you should change hosting providers because getting removed from a blacklist(s) can be time-consuming (or in your case, impossible).

  • you don't have a PTR record setup. You'll need to verify/ask your hosting provider to create one for you.

  • if it's mainly Yahoo! then you should review their best practices for sending mail.

  • are you spoofing the From: address? I would setup an SPF record (under "TXT" for your DNS Zone; it's fairly straightforward and your DNS management interface may have a built-in wizard).

share|improve this answer
    
That's a comment, not an answer. –  John Gardeniers Feb 14 '11 at 1:30
    
True. I'll edit it once he reponds with some details. –  gravyface Feb 14 '11 at 2:19
    
Hello again gravy face, that was the answer I was looking for! Turns out an IP close to mine is found on one obscure looking blacklist. But I can fairly safely say it's a false positive. It's pretty far from my domain and doesn't seem to be a very reputable blacklisting site. I am not spoofing the from address I do not believe, it indeed is a working/writable address. –  darkAsPitch Feb 28 '11 at 8:29
    
Yes, and often they will block an entire subnet if they detect an IP that they believe is part of the same organization/hosting provider. –  gravyface Feb 28 '11 at 13:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.