IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New How to debug PHP failing to send email?
My (hosted) server has stopped sending email. The hosting company says they can't trace what's happening to an email until it's received, then they look at the headers. Yeah, umm ... it's not getting received.

When the 'mail' function is called, it returns true (success), but nothing ever gets to the recipient. How do I trace this?

By the way, it was working for several months up until two hours ago. Right when I announced the book was ready to order.
--

Drew
New Get a local account in their domain
Preferably in the same data center (if possible).
Send the email to that, and all local logs can be examined.

Note: Been there, done that. Lost a day of orders when internal ISP Web server just threw away the outbound email.
New I'm sending to my own email address
Can't confirm they're in the same data center, but the domain is the same for the web server and the mail server. Nothing showing up in my inbox.

Is there some way a sysadmin would be able to look for outbound SMTP from the web server?
--

Drew
New Well how about that
I narrow it down to the simplest test case. They actually left the file in my home directory that they used to test PHP email after the migration. Still had their technician's email addy in it.

I called them, got a tech to look at that file. He started looking at my MX records. I explained why that wasn't it. Said he'd forward the ticket to programming. I explained why that wasn't it.

Told him that most likely it was a sysadmin issue. Either someone had changed the sendmail configuration on the webserver, or they had changed a routing rule between the webserver and the internet. And it had happened between 8:30 (last confirmed email sent) and 10:30 (when I noticed the issue) last night.

He writes it all down and says they'll email me in the morning.

Twenty minutes later, I get an email from that little test file. And now my other apps seem to be sending again. I wonder what the email tomorrow morning will say? I wonder if I'll even get one?
--

Drew
New I hate PHP's mail() function.
It is way too idiosyncratic and highly dependant on php.ini settings that often rely on a mail injector running locally and correctly configured. It needs to *Go Away* and I wish the PHP people would realize that.

PHPMailer is generally regarded as the best replacement, as it either completely avoids the local SMTP handling, or knows how to make it work correctly behind an API that makes sense.

But of course, you don't have the luxury of changing your code, do you? :-/ They probably turned off the local MTA. Unfortunately, that doesn't make mail() spit back an error because the local injector still runs! The way to debug that is to rummage in the local SMTP logs.

Wade.

Q:Is it proper to eat cheeseburgers with your fingers?
A:No, the fingers should be eaten separately.
New And I don't get SMTP logs
But I do have the luxury of changing the code. The app I'm using is ... unfinished. I've already updated the piece of code that handles sending multiple messages on a schedule -- assuming I get them to fix crontab [sigh] -- to use PEAR Mail_Mime. I discovered last night the code for sending one-off messages doesn't use the same functions.
--

Drew
New Oh, well, then PHP Mailer is recommended.
I haven't used anything in PEAR in years; the average quality of code last time I looked was dreadfully low.

Wade.

Q:Is it proper to eat cheeseburgers with your fingers?
A:No, the fingers should be eaten separately.
New Really? I haven't had any problems with PEAR
Of course I'm only using Mail (and Mail_Mime), DB and Log. They're fairly straightforward, and are things that I had written myself before PEAR was available. The syntax for calling each of them was so similar to what I had already done that it was easy to switch out, and use something maintained by more than just me.
--

Drew
New I looked at DB and ilk a few years ago.
None of them could do what my own custom handler could already do and when I looked at what it would take to modify one of them so they could, I was turned off by the code. It was simplistic where it shouldn't have been, complex where it was unnecessary and condescending when you didn't subscribe to the author's vision. :-/

Wade.

Q:Is it proper to eat cheeseburgers with your fingers?
A:No, the fingers should be eaten separately.
     How to debug PHP failing to send email? - (drook) - (8)
         Get a local account in their domain - (crazy) - (7)
             I'm sending to my own email address - (drook) - (6)
                 Well how about that - (drook) - (5)
                     I hate PHP's mail() function. - (static) - (4)
                         And I don't get SMTP logs - (drook) - (3)
                             Oh, well, then PHP Mailer is recommended. - (static) - (2)
                                 Really? I haven't had any problems with PEAR - (drook) - (1)
                                     I looked at DB and ilk a few years ago. - (static)

I'm sure I've heard those last 3 lines in an unsavoury movie.
157 ms