[Evolution] I can't use my email address in Evolution
- From: Ian Goldberg <ian cypherpunks ca>
- To: evolution ximian com
- Subject: [Evolution] I can't use my email address in Evolution
- Date: 23 Jan 2002 14:47:34 -0500
I just tried to use one of my email address <n ai> in the Email Address
field of a new Evolution account, and discovered it won't let me.
Looking at the code to see why:
is_email (const char *address)
const char *at, *hname;
at = strchr (address, '@');
/* make sure we have an '@' and that it's not the first or last
if (!at || at == address || *(at + 1) == '\0')
hname = at + 1;
/* make sure the first and last chars aren't '.' */
if (*hname == '.' || hname[strlen (hname) - 1] == '.')
return strchr (hname, '.') != NULL;
That last line is causing the problem; it's insisting that valid
hostnames have dots in them, which simply isn't true.
[iang janus iang]$ nslookup ai
That's *not* a machine called "ai" in some unspecified local domain.
That's the 2-letter country code "ai" (Anguilla), and this is the
top-level machine for the country. I've got an account there called
"n", so my email address is <n ai>. No dots.
Patch: change that last line to "return TRUE;". If you wanted to be
more clever, there are only a handful of machine names out there with no
dots in them, and you could hardcode the exceptions list, or something.
Slightly different would be to simply allow any host part consisting
solely of 2 letters(*). I guess it's better to allow things which
aren't actually valid address than to deny valid addresses.
(*) But those new TLDs like info and museum may someday add A records
for the TLD, so that's not strictly correct, either. How about just
assume the user knows better than you what his email address is?
] [Thread Prev