You might want to checkout the perl module Regex::Common::Email::Address
On 2017-01-06 13:16, Petr Hanousek wrote:
thank you, I'll try to implement it here. Wonder if someone has done it
before or if there is any plugin for this? Or (the best way) if some
developer encodes it to some future release of RT? :)
On 5.1.2017 21:51, Jeffrey Pilant wrote:
It indicates the 'most' official regex is:
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:
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.
The information contained in this e-mail is for the exclusive use of
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.