Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Rules for valid email addresses

 [1/2] from: bkalef:sympatico:ca at: 20-Oct-2001 0:40


Anyone know what characters and character combinations are invalid in email addresses? Has anyone build a function to check for email address validation?
>> type? my$[name--sympatico--ca]
== email!
>> type? my>[name--sympatico--ca]
== email! send my$[name--sympatico--ca] "testing" ** User Error: Server error: tcp 550 Invalid recipient: <my$[name--sympatico--ca]> ** Near: insert port reduce data
>> send my>[name--sympatico--ca] "testing"
** User Error: Server error: tcp 550 Invalid recipient: <my> ** Near: insert port reduce data I received a very large list of email addresses that needed to be sent a message - the list was never validated for address validity. When I loaded th file into a rebol word errors were reported indicating certain addresses were not valid. However, when I finally tried sending the emails out still more valid addresses existed that as noted above would have passed the 'load' of the data. Brock

 [2/2] from: greggirwin::mindspring::com at: 20-Oct-2001 12:03


Hi Brock, << Anyone know what characters and character combinations are invalid in email addresses? >> RFC822 talks about addresses and Jeff Friedl talks about them at length in his book 'Mastering Regular Expressions'. They *can* be pretty darn hairy, as the spec shows: address = mailbox ; one addressee / group ; named list group = phrase ":" [#mailbox] ";" mailbox = addr-spec ; simple address / phrase route-addr ; name & addr-spec route-addr = "<" [route] addr-spec ">" route = 1#("@" domain) ":" ; path-relative addr-spec = local-part "@" domain ; global address local-part = word *("." word) ; uninterpreted ; case-preserved domain = sub-domain *("." sub-domain) sub-domain = domain-ref / domain-literal domain-ref = atom ; symbolic reference Mr. Friedl built a regex that does it (everything but nested comments he says in the book) which is almost 5K in length. Can you imagine!? << Has anyone build a function to check for email address validation? >> Not that I know of, though REBOL's parscentricity would make it a good candidate. :) --Gregg