Unreliable mail delivery through PHP

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

 



Hello,

I have a function that is called each time a new visitor creates an
account on our site. The function is as follows:

<?php

function send_new_account_alert()
{
    $to            = ADMIN_EMAIL;
    $from          = "Accounts <accounts@".SITE_DOMAIN.">";
    $subject       = "New Account Created at ".SITE_NAME;
    $tmp_ADMIN_URL = ADMIN_URL;

    $body = <<<QQQ
A new account has been created and needs approval. You can find a list
of
accounts that nead approval by logging in to the admin section found at:

$tmp_ADMIN_URL

Do not reply to this email as it is unattended.
QQQ;

    send_email($to, $from, $subject, $body);
}

function send_email($to, $from, $subject, $body, $bcc = false)
{
    $headers = "From: $from\n"
              ."Reply-To: $from\n"
              ."X-Mailer: PHP/".phpversion();

    if($bcc != false)
    {
        $headers .= "\nBcc: $bcc";
    }

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

?>

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.

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.

Any ideas are welcome.


Thanks,
Chris.

-- 
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