Re: [rt-users] no alert for invalid mail addresses

2017-01-06 Thread Jeffrey Pilant
Martin Wheldon writes:
> You might want to checkout the perl module Regex::Common::Email::Address

I looked at that

http://search.cpan.org/~cwest/Regexp-Common-Email-Address-1.01/lib/Regexp/Common/Email/Address.pm
Provides a regex to match email addresses as defined by RFC 2822. Under
C<{-keep}>, the entire match is kept as C<$1>. If you want to parse that
further then pass it to C<< Email::Address->parse() >>. Don't worry,
it's fast.

This is from 2005, and the that RFC was replaced by 5322, which is what the big 
regex I gave was from.

The Wikipedia has even more relevant info on email addresses:
https://en.wikipedia.org/wiki/Email_address
It talks about support for foreign character sets, quoted normally invalid 
characters, allowed comments, and do on.  Basically, it is nearly complete 
chaos.  Check out their "valid" and "invalid" examples, as well as the 
internationalization example.

/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. 



Re: [rt-users] no alert for invalid mail addresses

2017-01-06 Thread Martin Wheldon

Hi,

You might want to checkout the perl module Regex::Common::Email::Address

Best Regards

Martin

On 2017-01-06 13:16, Petr Hanousek wrote:

Hello Jeffrey,
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? :)
Petr

On 5.1.2017 21:51, Jeffrey Pilant wrote:

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.




Re: [rt-users] no alert for invalid mail addresses

2017-01-06 Thread Petr Hanousek
Hello Jeffrey,
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? :)
Petr

On 5.1.2017 21:51, Jeffrey Pilant wrote:
> 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. 
> 
> 

-- 
+---+
   Petr Hanousek   e-mail: petr.hanou...@cesnet.cz
   MetaCentrum User Supportphone: +420 950 072 112
   CESNET z.s.p.o. mobile: +420 606 665 139
   location: Zikova 13a, Praha room: 32b
Czech Republic
+---+


Re: [rt-users] no alert for invalid mail addresses

2017-01-05 Thread Jeffrey Pilant
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. 



Re: [rt-users] no alert for invalid mail addresses

2017-01-05 Thread Matt Zagrabelny
On Thu, Jan 5, 2017 at 9:59 AM, Petr Hanousek  wrote:
> Thank you Matt, this will also help. BTW, for the curiosity, the "Merge
> with an alternate user" option behaves the same way like
> http://search.cpan.org/~bps/RT-Extension-MergeUsers/lib/RT/Extension/MergeUsers.pm
> or does it have some extra functionality?

No extra functionality. In fact the module in question depends on the
MergeUsers module.

-m


Re: [rt-users] no alert for invalid mail addresses

2017-01-05 Thread Petr Hanousek
Thank you Matt, this will also help. BTW, for the curiosity, the "Merge
with an alternate user" option behaves the same way like
http://search.cpan.org/~bps/RT-Extension-MergeUsers/lib/RT/Extension/MergeUsers.pm
or does it have some extra functionality?

But my main focus with this question was about to help that desperate
users who make that typos to realize, that no mail will come to the
intended recipient. Something like warning "Hey, this address is not
valid so your answer never reach anybody".

Imagine sending some info (like "downtime will occur next monday") to
multiple recipients and one of them has a typo like invalid domain in
his mail address. You feel safe that you've sent info to everybody
important but someone never receive that and surely will complain during
the unexpected downtime.

Petr


On 5.1.2017 16:09, Matt Zagrabelny wrote:
> Hi Petr,
> 
> We have this problem a lot.
> 
> BP wrote us this module to help manage autocreated users that don't
> belong in the database:
> 
> https://github.com/bestpractical/rt-extension-manageautocreatedusers
> 
> -m
> 
> On Thu, Jan 5, 2017 at 3:53 AM, Petr Hanousek  wrote:
>> 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.
>>
>> Thank you, Petr


Re: [rt-users] no alert for invalid mail addresses

2017-01-05 Thread Matt Zagrabelny
Hi Petr,

We have this problem a lot.

BP wrote us this module to help manage autocreated users that don't
belong in the database:

https://github.com/bestpractical/rt-extension-manageautocreatedusers

-m

On Thu, Jan 5, 2017 at 3:53 AM, Petr Hanousek  wrote:
> 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.
>
> Thank you, Petr
>
> --
> +---+
>Petr Hanousek   e-mail: petr.hanou...@cesnet.cz
>MetaCentrum User Supportphone: +420 950 072 112
>CESNET z.s.p.o. mobile: +420 606 665 139
>location: Zikova 13a, Praha room: 32b
> Czech Republic
> +---+


[rt-users] no alert for invalid mail addresses

2017-01-05 Thread Petr Hanousek
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.

Thank you, Petr

-- 
+---+
   Petr Hanousek   e-mail: petr.hanou...@cesnet.cz
   MetaCentrum User Supportphone: +420 950 072 112
   CESNET z.s.p.o. mobile: +420 606 665 139
   location: Zikova 13a, Praha room: 32b
Czech Republic
+---+