Petr Hanousek writes:
>Hi geeks,
>sometimes someone here mistypes the mail address of Requestor or CC. The
>typos in addresses are various, my question is about the really obvious
>ones. Like if you put to CC an address "a@b". Is there any mechanism in
>RT to detect such mistakes and say something at least? Or can I have a
>feature request for this? :)
>
>If you try this in Gmail or Thunderbird, an error is raised and the
>message is not sent.
Check out
http://www.regular-expressions.info/email.html
It indicates the 'most' official regex is:
\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*
| "(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]
| \\[\x01-\x09\x0b\x0c\x0e-\x7f])*")
@ (?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
| \[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}
(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:
(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]
| \\[\x01-\x09\x0b\x0c\x0e-\x7f])+)
\])\z
Yeah. Quite a mouthful. This is because there are quite a few ways to express
email addresses. And even this is not foolproof.
The same page also has other simpler regex expressions that work a fair amount
of the time, but are less complicated, like:
\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b
The page claims it is 99% effective.
That, however, does not solve your problem. Just because it is formulated
correctly does not mean it is a valid address.
The usual solution is to whitelist the addresses and do a lookup. Any address
not found gets added tentatively, but flagged for testing. You can also at
this time prompt for acceptance vs. going back to an edit screen. This does
require you maintain a list of valid email addresses somewhere. The user list
is a likely place, but if you are sending emails to people who are not users,
then that fails.
/jeff
________________________________________________________________________
The information contained in this e-mail is for the exclusive use of the
intended recipient(s) and may be confidential, proprietary, and/or
legally privileged. Inadvertent disclosure of this message does not
constitute a waiver of any privilege. If you receive this message in
error, please do not directly or indirectly use, print, copy, forward,
or disclose any part of this message. Please also delete this e-mail
and all copies and notify the sender. Thank you.
________________________________________________________________________