help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I check if the format of an email address is valid?


From: Lennart Borgman
Subject: Re: How do I check if the format of an email address is valid?
Date: Fri, 31 Mar 2006 13:26:11 +0200
User-agent: Thunderbird 1.5 (Windows/20051201)

Reiner Steib wrote:
Is anyone aware of any missing TLDs?

(defcustom message-valid-fqdn-regexp
  (concat "[a-z0-9][-.a-z0-9]+\\." ;; [hostname.subdomain.]domain.
          ;; valid TLDs:
          "\\([a-z][a-z]" ;; two letter country TDLs
          "\\|biz\\|com\\|edu\\|gov\\|int\\|mil\\|net\\|org"
          "\\|aero\\|coop\\|info\\|name\\|museum"
          "\\|arpa\\|pro\\|uucp\\|bitnet\\|bofh" ;; old style?
          "\\)")
  "Regular expression that matches a valid FQDN."
  ;; see also: gnus-button-valid-fqdn-regexp
  :version "22.1"
  :group 'message-headers
  :type 'regexp)
You can customize the variable!

BTW, the tin newsreader even hard-codes a matrix of (in)valid
two letter country domains. The user/admin has to recompile to add new
domains.  IIRC it's used when checking for a valid FQDN.

This argument can be used in the reverse direction too. Do most
users really gain something from the list of known TLD:s in the
regexp?

For the purpose in Gnus: Yes, IMHO.  What would you suggest to use
instead?
Why not just [a-z]{2, 6}

I just want to check the format of email addresses entered on a html page.

And you'll post-process it using Emacs?
Just what the user entered (in completion in nxhtml-mode).

I wasn't joking. :-)  Of course not from the format, but...

Basically you need to do something like "host -t mx" (using
`dig.el'?), connect to the smtp port, send "RCPT TO:" and parse the
output ("user unknown"?).  But I'm not sure if this still works
nowadays.

Bye, Reiner.
Thanks, I did not know. But that seems out of the scope for me right now. (And it is a bit complicated to find the tools on w32 - but they seem to be in BIND.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]