Re: Unreliable mail delivery through PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>     mail($to, $subject, $body, $headers);

The mail() function returns true/false upon success/failure in injecting
the email into the mail queue.

You should be grabbing and checking the return value.

It's probably not the culprit here, but is Good Programming Practice.

> Assuming all the email addresses are correct, is there anything about
> the above two functions that is incorrect or might be causing the
> unreliable'ness'? Or maybe someone has some tips for debugging this kind
> of thing?
>
> Specifically, what's happening is that I don't get the same number of
> emails as I do new users. Let's say I get an email notifying me of a new
> account, when I get to the Admin section I'll see that there are maybe
> 2, 3, or 4 accounts waiting to be approved (administrator approval is
> required in most cases). But I didn't get that many emails, I just got
> the one.

Perhaps the other emails are still "coming"?

> I haven't been able to figure out why yet. The server is not under any
> amount of load (almost no load in fact) that would cause something like
> this.

Perhaps use error_log() when an account is created, and sprinkle other
error_log() calls throughout the script to log each action/function as it
occurs.

You should be able to at least "prove" that PHP is calling the mail()
function when it should.

PS
You may want to consider setting things up so you only get one (1) email
per day with the number of users with queued actions.  Otherwise, if you
ever *DO* get a ton of accounts pouring in, your Inbox will overflow
rather quickly.

It takes little more effort to run a cron job on "new" users with not
quite active accounts and email your Admin a summary than a new email on
each user insert.

-- 
Like Music?
http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux