Jump to content


This topic is now archived and is closed to further replies.


mail function and invalid email addresses

Recommended Posts

I have a php script that sends out emails using the mail() function and for some reason if the email address is incorrect it doesn't send a bounce message to the reply address even though it's set correctly in the headers. Any ideas on how I can fix this?

Share this post

Link to post
Share on other sites
Send the bounce message yourself.  It probably doesn't bounce becuase it never gets sent.

if(!mail('asdf@asdf.com', 'Subject', 'Message'))
    mail('me@com.com', 'Message: Subject did not go through', 'Error Sending Message: Subject With contents: \nMessage');

Share this post

Link to post
Share on other sites
There are a few things to consider - minor but FYI worth remeberign for the future...

If this is a case where you want to ensure that the email address provided by a user is valid then check this out [url=http://www.zend.com/zend/spotlight/ev12apr.php#Heading11]http://www.zend.com/zend/spotlight/ev12apr.php#Heading11[/url] a brilliant method to use during the sigin up process (IMO of course).

Now notwithstanding that I like the above method - its not infallable - the script that actually asks the server if an email address would be accepted does not mean to say that email address exists - they may have a catch all enabled on the domain.

The other point to note is that checking the true/false status of the mail function, if the inbox may simply be full - the email is valid but it will/may be bumped back - making you think that its an invalid address.  You could delete an address that is perfectly OK.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.