getting php mail error info [message #184877] |
Wed, 12 February 2014 23:50  |
GS
Messages: 3 Registered: February 2014
Karma: 0
|
Junior Member |
|
|
I've got a php mail script which was working ok but the mail() call
returned a bunch of errors today. The trouble is that it only returns true
or false, I was wondering if there is any way to get more feedback from
sendmail about what what went wrong, since I don't know whether I fed it
bad data or whether sendmail playing up. I can't find any alternative mail
calls I could use in the PHP manual.
This is on a shared virtual hosting system so I don't have access to the
linux or sendmail configuration and I can't find any log files in my
userspace that pertain to the sendmail calls. The system is running PHP
5.3.27, I think the OS is Linux 2.6.32.
|
|
|
|
|
|
|
|
|
Re: getting php mail error info [message #184902 is a reply to message #184898] |
Fri, 14 February 2014 15:00   |
Ben Bacarisse
Messages: 82 Registered: November 2013
Karma: 0
|
Member |
|
|
Jerry Stuckle <jstucklex(at)attglobal(dot)net> writes:
> On 2/13/2014 8:42 AM, Ben Bacarisse wrote:
>> Michael Vilain <vilain(at)NOspamcop(dot)net> writes:
>>
>>> In article <XnsA2D2F27E54CEFR2D2(at)127(dot)0(dot)0(dot)1>,
>>> GS <nomail(at)nospam(dot)org(dot)invalid> wrote:
>>>
>>>> I've got a php mail script which was working ok but the mail() call
>>>> returned a bunch of errors today. The trouble is that it only returns true
>>>> or false, I was wondering if there is any way to get more feedback from
>>>> sendmail about what what went wrong, since I don't know whether I fed it
>>>> bad data or whether sendmail playing up. I can't find any alternative mail
>>>> calls I could use in the PHP manual.
>>>>
>>>> This is on a shared virtual hosting system so I don't have access to the
>>>> linux or sendmail configuration and I can't find any log files in my
>>>> userspace that pertain to the sendmail calls. The system is running PHP
>>>> 5.3.27, I think the OS is Linux 2.6.32.
>>>
>>> mail() is all you're gonna get in a shared hosting facility.
>>
>> I've used one shared hosting provided that offered the PEAR Mail module
>> which could be used to connect to whatever SMTP server you liked (one of
>> which was their own). It was a while ago, but I think you get better
>> error messages from it, though nothing is going to beat getting the
>> server's logs for diagnosing the problem.
>>
>> <snip>
>
> How does that solve his problem? He doesn't want to connect to a
> different email server - he wants to get this one working.
Often, (usually? always?) the local sendmail is just a client that
connects to the local MTA. If you use the Mail module to connect, you
can, sometimes, get more error information than you do from mail().
Nothing that happens once the message is queued, of course, but if the
mail logs are inaccessible, it might be better than the success/fail
from PHP's mail() function.
--
Ben.
|
|
|
Re: getting php mail error info [message #184913 is a reply to message #184902] |
Sat, 15 February 2014 18:54   |
Peter H. Coffin
Messages: 245 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On Fri, 14 Feb 2014 15:00:28 +0000, Ben Bacarisse wrote:
> Often, (usually? always?) the local sendmail is just a client that
> connects to the local MTA. If you use the Mail module to connect, you
> can, sometimes, get more error information than you do from mail().
> Nothing that happens once the message is queued, of course, but if the
> mail logs are inaccessible, it might be better than the success/fail
> from PHP's mail() function.
OP said the mail() returned false. That's not usually a problem that's
going to show up in mail logs, because it's not even gotten as far as
something that logs anything. Why a mail submission would fail varies by
host OS, too. Pretty much NOTHING short of a systemwide mail failure or
a blatantly obvious problem with the submission (Nothing in the $to, for
example) will get a mail() fail on a unix system. Windows will fail a
mail() if the remote Mail Transport Agent doesn't answer or rejects the
mail, which it *may* do for any reason, including "you've sent too much
mail lately". In that case, yeah, it might be tricky, but there's still
going to be no logs to look at.
--
Cunningham's First Law:
Any sufficiently complex deterministic system will exhibit
non-deterministic behaviour.
|
|
|
Re: getting php mail error info [message #184914 is a reply to message #184913] |
Sun, 16 February 2014 01:06   |
Ben Bacarisse
Messages: 82 Registered: November 2013
Karma: 0
|
Member |
|
|
"Peter H. Coffin" <hellsop(at)ninehells(dot)com> writes:
> On Fri, 14 Feb 2014 15:00:28 +0000, Ben Bacarisse wrote:
>> Often, (usually? always?) the local sendmail is just a client that
>> connects to the local MTA. If you use the Mail module to connect, you
>> can, sometimes, get more error information than you do from mail().
>> Nothing that happens once the message is queued, of course, but if the
>> mail logs are inaccessible, it might be better than the success/fail
>> from PHP's mail() function.
>
> OP said the mail() returned false. That's not usually a problem that's
> going to show up in mail logs, because it's not even gotten as far as
> something that logs anything.
That's a good point. The number of things that can go wrong and still
be logged is very small.
> Why a mail submission would fail varies by
> host OS, too. Pretty much NOTHING short of a systemwide mail failure or
> a blatantly obvious problem with the submission (Nothing in the $to, for
> example) will get a mail() fail on a unix system.
That does get logged by my MTA (masqmail) but I imagine that's just
about the only error where mail() fails and something shows up.
> Windows will fail a
> mail() if the remote Mail Transport Agent doesn't answer or rejects the
> mail, which it *may* do for any reason, including "you've sent too much
> mail lately". In that case, yeah, it might be tricky, but there's still
> going to be no logs to look at.
--
Ben.
|
|
|
Re: getting php mail error info [message #184915 is a reply to message #184913] |
Sun, 16 February 2014 01:24  |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 2/15/2014 1:54 PM, Peter H. Coffin wrote:
> On Fri, 14 Feb 2014 15:00:28 +0000, Ben Bacarisse wrote:
>> Often, (usually? always?) the local sendmail is just a client that
>> connects to the local MTA. If you use the Mail module to connect, you
>> can, sometimes, get more error information than you do from mail().
>> Nothing that happens once the message is queued, of course, but if the
>> mail logs are inaccessible, it might be better than the success/fail
>> from PHP's mail() function.
>
> OP said the mail() returned false. That's not usually a problem that's
> going to show up in mail logs, because it's not even gotten as far as
> something that logs anything. Why a mail submission would fail varies by
> host OS, too. Pretty much NOTHING short of a systemwide mail failure or
> a blatantly obvious problem with the submission (Nothing in the $to, for
> example) will get a mail() fail on a unix system. Windows will fail a
> mail() if the remote Mail Transport Agent doesn't answer or rejects the
> mail, which it *may* do for any reason, including "you've sent too much
> mail lately". In that case, yeah, it might be tricky, but there's still
> going to be no logs to look at.
>
Peter,
Actually, my MTA (Exim on Debian) does log why a submission was
rejected. And while this is the default for the setup, the actions can
be changed by the sysadmin.
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
|
|
|