You call that "good" ? :P On Thu, Apr 12, 2012 at 5:06 PM, Les Hughes <[email protected]> wrote:
> Joseph Clark wrote: > >> I'm no expert on this either, but I'm fairly certain that this business >> requirement is simply not achievable. Due to the way mail servers operate >> on the Internet, there is no way for a sender to know if an intended >> recipient address is valid. >> >> An email may go through several mail exchanges before it arrives at the >> one that will ultimately deliver to the user's inbox. At any point along >> the way, the email may be rejected for any variety of reasons and this >> rejection may occur asynchronously. >> > Hi Muhammad, > > While I share a similar view about the requirements as the other posters, > that what you are trying to do will not be possible as a 100% working case. > > BUT > > Here are a few things you can do: > > - Let's say your domain is taxionline.com: set the 'return-to' header > variable to [email protected] > > - Have some code which retrieves the bounce@ emails, looking for the > emails which have 550 errors + the rest of them. Note that some returns > will be "Out of Office" replies and so-forth. Here is some java code which > helps sort emails by category: http://javaclue.blogspot.com.** > au/2009/09/detect-bounced-**emails-part-2.html<http://javaclue.blogspot.com.au/2009/09/detect-bounced-emails-part-2.html> > > As others have noted, there are (at least) the following issues: > - Your email might be rejected as spam by a server somewhere between you > and the end mail server > - When the email is dropped, you might not get any confirmation. > - Any confirmation can take a long time to come back, making the whole > exercise pointless. > - Bounces might not be to standard, meaning you miss them. > - Classifying an innocent email as a bounce would be disastrous for any > legitimate user of your service. > - While I don't know your business case, it seems automating this might be > problematic in terms of how you deal with it, and something like an > SMS/Phone confirmation (while also having inherent issues) might be > something else to consider. > > Regardless, good luck :) > -- > Les Hughes > [email protected] > > P.S. For those interested, here is a good regular expression for email > validation: > > (?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[**\] > \000-\031]+(?:(?:(?:\r\n)?[ \t] > )+|\Z|(?=[\["()<>@,;:\\".\[\]]**))|"(?:[^\"\r\\]|\\.|(?:(?:\r\**n)?[ > \t]))*"(?:(?: > \r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] > \000-\031]+(?:(?:( > ?:\r\n)?[ > \t])+|\Z|(?=[\["()<>@,;:\\".\[**\]]))|"(?:[^\"\r\\]|\\.|(?:(?:**\r\n)?[ > \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] > \000-\0 > 31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[** > \]]))|\[([^\[\]\r\\]|\\.)*\ > ](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] > \000-\031]+ > (?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[** > \]]))|\[([^\[\]\r\\]|\\.)*\](?**: > (?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z > |(?=[\["()<>@,;:\\".\[\]]))|"(**?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ > \t]))*"(?:(?:\r\n) > ?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] > \000-\031]+(?:(?:(?:\ > r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[**\]]))|\[([^\[\]\r\\]|\\.)*\](?** > :(?:\r\n)?[ > \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] > \000-\031]+(?:(?:(?:\r\n) > ?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[**\]]))|\[([^\[\]\r\\]|\\.)*\](?**:(?:\r\n)?[ > \t] > )*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] > \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\["()<>@,;:\\".\[**\]]))|\[([^\[\]\r\\]|\\.)*\](?**:(?:\r\n)?[ > \t])* > )(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t] > )+|\Z|(?=[\["()<>@,;:\\".\[\]]**))|\[([^\[\]\r\\]|\\.)*\](?:(?**:\r\n)?[ > \t])*))*) > *:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+ > |\Z|(?=[\["()<>@,;:\\".\[\]]))**|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)**?[ > \t]))*"(?:(?:\r > \n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] > \000-\031]+(?:(?:(?: > \r\n)?[ > \t])+|\Z|(?=[\["()<>@,;:\\".\[**\]]))|"(?:[^\"\r\\]|\\.|(?:(?:**\r\n)?[ > \t > ]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] > \000-\031 > ]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[** > \]]))|\[([^\[\]\r\\]|\\.)*\]( > ?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] > \000-\031]+(? > :(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[** > \]]))|\[([^\[\]\r\\]|\\.)*\](?**:(? > :\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)|(?:[^()<>@,;:\\".\[\] > \000-\031]+(?:(? > :(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[**\]]))|"(?:[^\"\r\\]|\\.|(?:(?: > **\r\n)? > [ \t]))*"(?:(?:\r\n)?[ \t])*)*:(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[ > **\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[** > \]]))|"(?:[^\"\r\\]| > \\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ > \t])*(?:[^()<> > @,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[** > \]]))|" > (?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ > \t] > )*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\["()<>@,;:\\ > ".\[\]]))|\[([^\[\]\r\\]|\\.)***\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ > \t])*(? > :[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\["()<>@,;:\\".\[ > \]]))|\[([^\[\]\r\\]|\\.)*\](?**:(?:\r\n)?[ > \t])*))*|(?:[^()<>@,;:\\".\[\] \000- > \031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[** > \]]))|"(?:[^\"\r\\]|\\.|( > ?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ > \t])*(?:@(?:[^()<>@,; > :\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[** > \]]))|\[([ > ^\[\]\r\\]|\\.)*\](?:(?:\r\n)?**[ \t])*)(?:\.(?:(?:\r\n)?[ > \t])*(?:[^()<>@,;:\\" > .\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[** > \]]))|\[([^\[\ > ]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ > \t])*(?:[^()<>@,;:\\".\ > [\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[** > \]]))|\[([^\[\]\ > r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ > \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\["()<>@,;:\\".\[**\]]))|\[([^\[\]\r\\] > |\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ > \t])*)?(?:[^()<>@,;:\\".\[\] \0 > 00-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[** > \]]))|"(?:[^\"\r\\]|\\ > .|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ > \t])*(?:[^()<>@, > ;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[** > \]]))|"(? > :[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ > \t])* > (?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\["()<>@,;:\\". > \[\]]))|\[([^\[\]\r\\]|\\.)*\]**(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ > \t])*(?:[ > ^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\["()<>@,;:\\".\[**\] > ]))|\[([^\[\]\r\\]|\\.)*\](?:(**?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ > \t])*)(?:,\s*( > ?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\["()<>@,;:\\ > ".\[\]]))|"(?:[^\"\r\\]|\\.|(?**:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ > \t])*)(?:\.(?:( > ?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[ > \["()<>@,;:\\".\[\]]))|"(?:[^\**"\r\\]|\\.|(?:(?:\r\n)?[ > \t]))*"(?:(?:\r\n)?[ \t > ])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] > \000-\031]+(?:(?:(?:\r\n)?[ \t > ])+|\Z|(?=[\["()<>@,;:\\".\[\]**]))|\[([^\[\]\r\\]|\\.)*\](?:(**?:\r\n)?[ > \t])*)(? > :\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+| > \Z|(?=[\["()<>@,;:\\".\[\]]))|**\[([^\[\]\r\\]|\\.)*\](?:(?:\**r\n)?[ > \t])*))*|(?: > [^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\["()<>@,;:\\".\[**\ > ]]))|"(?:[^\"\r\\]|\\.|(?:(?:\**r\n)?[ \t]))*"(?:(?:\r\n)?[ > \t])*)*\<(?:(?:\r\n) > ?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\[" > ()<>@,;:\\".\[\]]))|\[([^\[\]\**r\\]|\\.)*\](?:(?:\r\n)?[ > \t])*)(?:\.(?:(?:\r\n) > ?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\["()<> > @,;:\\".\[\]]))|\[([^\[\]\r\\]**|\\.)*\](?:(?:\r\n)?[ > \t])*))*(?:,@(?:(?:\r\n)?[ > \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\["()<>@, > ;:\\".\[\]]))|\[([^\[\]\r\\]|\**\.)*\](?:(?:\r\n)?[ > \t])*)(?:\.(?:(?:\r\n)?[ \t] > )*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\["()<>@,;:\\ > ".\[\]]))|\[([^\[\]\r\\]|\\.)***\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ > \t])*)? > (?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\["()<>@,;:\\". > \[\]]))|"(?:[^\"\r\\]|\\.|(?:(**?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ > \t])*)(?:\.(?:(?: > \r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z|(?=[\[ > "()<>@,;:\\".\[\]]))|"(?:[^\"\**r\\]|\\.|(?:(?:\r\n)?[ > \t]))*"(?:(?:\r\n)?[ \t]) > *))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t]) > +|\Z|(?=[\["()<>@,;:\\".\[\]])**)|\[([^\[\]\r\\]|\\.)*\](?:(?:**\r\n)?[ > \t])*)(?:\ > .(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ > \t])+|\Z > |(?=[\["()<>@,;:\\".\[\]]))|\[**([^\[\]\r\\]|\\.)*\](?:(?:\r\**n)?[ > \t])*))*\>(?:( > ?:\r\n)?[ \t])*))*)?;\s*) > > > Source: > http://www.ex-parrot.com/~pdw/**Mail-RFC822-Address.html<http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html> > > Also interesting, a comparison of different regular expressions for email: > http://www.pgregg.com/**projects/php/code/**showvalidemail.php<http://www.pgregg.com/projects/php/code/showvalidemail.php> > > -- Heinrich Breedt “Do not wait to strike till the iron is hot; but make it hot by striking.” - William B. Sprague
