how to check for email bounce using mail() function

the mail() function

Moderators: macek, egami, gesf

Post Reply
TheProdigyGuy
New php-forum User
New php-forum User
Posts: 215
Joined: Wed Dec 07, 2011 5:25 pm

Re: how to check for email bounce using mail() function

Post by TheProdigyGuy » Tue Jan 10, 2012 3:37 pm

from php.net notes about PHP mail() function:

Code: Select all

Return Values
Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise. 

It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination. 

IMHO theris no proper way directly using PHP to check is that $to address exist and your mail delivery was successfull.
Generally when using bounce way right way to check is it accepted by remote server it is check your mailbox.
If that $to (mail addr) is not exist on remote mail server on that remote mail server will automatically reply to you:
Can't deliver your msg.bla bla bla + a lot of tonnes server info))

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: how to check for email bounce using mail() function

Post by egami » Tue Jan 10, 2012 5:39 pm

This is the reason why you will often see

if (mail($to,$subject,$message,$headers)) {
// This is where you would write success code, or call some kind of success function...
} else {
// This is where the mail function fails, and you should/could call some kind of failed function or something
}

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest