Re: Behavior of mail() function

Pierre Joye <[email protected]>
Newsgroups gmane.comp.php.windows
Message-ID <[email protected]>
hi,

On Mon, Apr 19, 2010 at 9:22 PM, Lewis Kapell <[email protected]> wrote:
> Running PHP version 5.3.1, I find that if my script tries to send an email
> message to an address in the local domain, and the address is invalid,
> mail() throws an error:
>
> mail(): SMTP server response: 550 5.1.1 <[email protected]>: Recipient
> address rejected: User unknown in local recipient table
>
> Is there a way I can configure PHP so that mail() would return false in this
> case, rather than throwing an error which causes the script to die?

The script should not die. Mail returns false (no exception are
raised) on failure and can raise warnings. These warnings can be
disable using the http://www.php.net/error_reporting ini settings
(works per directory, per script or globally per php.ini).

Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.