After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 213724 - able to add invalid e-mail addresses to a contact list
able to add invalid e-mail addresses to a contact list
Status: RESOLVED DUPLICATE of bug 513438
Product: evolution
Classification: Applications
Component: Contacts
2.2.x (obsolete)
Other All
: Normal minor
: Future
Assigned To: evolution-addressbook-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2001-10-27 06:56 UTC by Miles Lane
Modified: 2012-01-27 09:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Example vcf (1.35 KB, text/plain)
2001-10-27 06:56 UTC, Miles Lane
  Details
Check on email validity (3.04 KB, patch)
2009-11-02 00:16 UTC, Roberto Guido
needs-work Details | Review
Check on email validity (2.05 KB, patch)
2010-01-25 01:36 UTC, Roberto Guido
none Details | Review

Description Miles Lane 2001-10-27 06:56:08 UTC
I am attaching an example VCF that I created.

Repro:

Open Contacts
Click "New List" button.
Type gobbledeegook into each of the fields and click Add.

Result:

No error is returned.
Comment 1 Miles Lane 2001-10-27 06:56:45 UTC
Created attachment 40443 [details]
Example vcf
Comment 2 Gerardo Marin 2002-10-03 20:28:43 UTC
Still happening in 1.1.1.99
Comment 3 André Klapper 2004-03-12 14:13:38 UTC
still happening in evolution-1.4.6.0.200403080631-0.snap.ximian.8.1, 
gnome2.4, suse9.0.
Comment 4 Gerardo Marin 2004-03-13 18:35:47 UTC
Still valid in 1.5.5.
Targeting for 2.1
Comment 5 JP Rosevear 2004-10-12 15:34:25 UTC
Shouldn't we have an "email address" entry that filters properly? 
Comment 6 André Klapper 2005-03-23 16:19:11 UTC
i don't think this one is important - if one enters a non-valid
address the mail just won't be sent to it.
there are many other more important UI issues than this one here.
therefore futuring, minoring priority.
Comment 7 Manoj 2005-04-26 08:53:32 UTC
still happening in 2.2, just need to check validation condition only for @ not
for  dot(.). 
Comment 8 Poornima 2006-06-01 10:12:16 UTC
type spaces in 'Type email address field' empty contact gets added in contact list
Comment 9 miles.lane 2007-04-26 03:32:37 UTC
Can this get fixed now please?  I submitted this report six years ago!
Comment 10 Lucky Wankhede 2007-07-19 07:56:17 UTC
Still valid in 2.11.5
Just check this... 
Comment 11 Roberto Guido 2009-11-02 00:16:08 UTC
Created attachment 146701 [details] [review]
Check on email validity

This patch introduces an e_validate_mail_address() function in e-utils, where can be used also in other situations.
If the new address doesn't matches it is not added in the list, but it remains in the text box so to be corrected by the user; this way no explicit notification is required, because user is already alerted by the unusual behaviour.
Comment 12 Milan Crha 2009-11-26 18:01:23 UTC
Calling unusual behaviour alerting is something I would not ever use. Not here.
For me, I would expect not being the Add button sensitive if I've an invalid address entered in the text field. Not a bad idea of the public function for checking of email validity, though you are too strict. For example, I am able to enter a valid email address like this:
   John Black <john@black.at>
to the contact list, but not with your patch.

I would suggest to:
a) define a local function for validity checking
b) use for validity checking camel_internet_address_new with
   camel_address_decode (and possibly with camel_internet_address_get to ensure
   the email part had been read), instead of regex
c) make Add button sensitive based on the email validity, instead of "do
   nothing on error"
Comment 13 Paul Smith 2010-01-21 14:22:29 UTC
Please do not add restrictions to email addresses.  The RE proposed in the patch is far, far too restrictive.  Many email addresses allow extra characters like "+" etc. for example.  Also, you can send email to the guy in the office next door in your same domain with just a hostname and no domain, in which case there will be no "." on the email address.  It's just wrong for Evo to arbitrarily restrict the email address.

The only characters I can think of offhand that I'd be comfortable omitting from valid usernames in email addresses are "," and space.  Probably it would be OK to eliminate ";" as well since Microsoft mail clients often use that to separate email addresses, rather than ",".  For UNIX-style systems, usernames cannot have ":" but other systems might be more lax.  Also you can create email aliases on UNIX systems (not sure if ":" is a valid char in an alias).  Probably best to not restrict it.

So, an RE I would be comfortable with would be something like:

    ^[^;, \t]+@[-_.a-zA-Z0-9]+$

(note RFCs I've read don't allow underscores in hostnames but I've seen it many times).  You don't need to escape special chars inside character classes, BTW.  It might even be wise to make the hostname more liberal.

There is already something somewhere in Evo that does this check: in the new account creation wizard, the "Next" button is greyed out until you enter enough of an email address to be valid; it's very liberal (probably something like the above although I didn't check it in the code). Maybe that could be re-used or made more generic?
Comment 14 Milan Crha 2010-01-21 15:08:32 UTC
(In reply to comment #13)
> There is already something somewhere in Evo that does this check: in the new
> account creation wizard, the "Next" button is greyed out until you enter enough
> of an email address to be valid; it's very liberal (probably something like the
> above although I didn't check it in the code). Maybe that could be re-used or
> made more generic?

It's checking for '@' and some surrounding letters only, which is pretty simple way of doing the check. Such test will not work for your "addresses" without domain, though.

I'm not sure if you noticed, but this is only about Contact List, not the composer.
Comment 15 Paul Smith 2010-01-21 18:14:51 UTC
Why won't it work?  I just mean that the hostname part of the email can't be required to contain a ".".  When I use the wizard, it requires a "@" and any one character after it, then it's satisfied.  It doesn't need a ".foo" on the end.

My opinion is that Evo shouldn't restrict any legal email address, regardless of whether it's in the contact list or composer.  I'm willing to require the email list to contain "@" (in other words we don't need to support email addresses to other users on the local system... if you really want that you could just use "foo@localhost"), and we should try to avoid addresses which are using obviously invalid characters, but other than that...
Comment 16 Roberto Guido 2010-01-25 01:36:13 UTC
Created attachment 152195 [details] [review]
Check on email validity

Here is a rework: the validation function is inspired by the one for the "New Account wizard", but also permits addresses in "Foo <foo@example.com>" form.
As discussed in mailing list ( http://mail.gnome.org/archives/evolution-hackers/2010-January/msg00016.html ) camel_address_decode() is not suitable for this kind of check.
Comment 17 André Klapper 2012-01-27 09:28:03 UTC
(In reply to comment #15)
> My opinion is that Evo shouldn't restrict any legal email address

+1

(In reply to comment #16)
> Check on email validity

See bug 513438 comment 17: "user@localhost (hint, no dot) is a bloody valid email address. As can even be the plain 'user', without any host part."

Marking as duplicate of that ticket.

*** This bug has been marked as a duplicate of bug 513438 ***