FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » getting php mail error info
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
getting php mail error info [message #184877] Wed, 12 February 2014 23:50 Go to next message
GS is currently offline  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 #184878 is a reply to message #184877] Thu, 13 February 2014 03:30 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/12/2014 6:50 PM, GS 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.
>

GS,

Unfortunately, all PHP gets back from sendmail is true or false -
whether sendmail accepted the request or not.

Any further information would have to come from the sendmail logs; I
suggest you contact your hosting company to see what they changed, and
perhaps a copy of their sendmail logs.

--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
Re: getting php mail error info [message #184884 is a reply to message #184877] Thu, 13 February 2014 07:16 Go to previous messageGo to next message
Michael Vilain is currently offline  Michael Vilain
Messages: 88
Registered: September 2010
Karma: 0
Member
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. If you
want to extend php or using a cgi script to send the mail, that's up to
your ISP if they'll allow it. But I would tend to doubt it.

Your next option is a vps where you can setup your own dedicated server
and run whatever you want on it. Usually more expensive but it's your
call on if it's worth it.

--
DeeDee, don't press that button! DeeDee! NO! Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]
Re: getting php mail error info [message #184885 is a reply to message #184877] Thu, 13 February 2014 11:25 Go to previous messageGo to next message
Derek Turner is currently offline  Derek Turner
Messages: 48
Registered: October 2010
Karma: 0
Member
On Wed, 12 Feb 2014 23:50:16 +0000, GS wrote:

> I've got a php mail script which was working ok but the mail() call
> returned a bunch of errors today.

Don't know if this is any help but I use zendmail on shared hosting. I was
given to understand, at the time I wrote the scripts, that it more secure.
Be that as it may, I've never had any problems with it. I understand that
it is possible to catch zendmail exceptions.
Re: getting php mail error info [message #184887 is a reply to message #184884] Thu, 13 February 2014 13:42 Go to previous messageGo to next message
Ben Bacarisse is currently offline  Ben Bacarisse
Messages: 82
Registered: November 2013
Karma: 0
Member
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>
--
Ben.
Re: getting php mail error info [message #184895 is a reply to message #184887] Fri, 14 February 2014 04:21 Go to previous messageGo to next message
Allodoxaphobia is currently offline  Allodoxaphobia
Messages: 21
Registered: September 2010
Karma: 0
Junior Member
On Thu, 13 Feb 2014 13:42:14 +0000, Ben Bacarisse wrote:
> Michael Vilain <vilain(at)NOspamcop(dot)net> writes:
>> 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).

+1

Jonesy
Re: getting php mail error info [message #184898 is a reply to message #184887] Fri, 14 February 2014 11:44 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
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.

--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
Re: getting php mail error info [message #184902 is a reply to message #184898] Fri, 14 February 2014 15:00 Go to previous messageGo to next message
Ben Bacarisse is currently offline  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 Go to previous messageGo to next message
Peter H. Coffin is currently offline  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 Go to previous messageGo to next message
Ben Bacarisse is currently offline  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 Go to previous message
Jerry Stuckle is currently offline  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
==================
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Array key names
Next Topic: strpos() before str_replace()? Or, maybe strtr()?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 23:40:02 GMT 2024

Total time taken to generate the page: 0.02711 seconds