Email address syntax check

For technical support for all editions of CSS HTML Validator. Includes bug reports.
Post Reply
User avatar
kgish
Rank I - Novice
Rank I - Novice
Posts: 11
Joined: Sat Apr 02, 2005 3:34 am
Location: Gouda, The Netherlands
Contact:

Email address syntax check

Post by kgish »

When I use the following HTML code for an email link:

<a href="mailto:Joe Smoe <joe@nl.smoe.net>">joe@nl.smoe.net</a>

I get the following syntax warning:

The email address or addresses specified in the mailto link "mailto:Joe Smoe <joe@nl.smoe.net>" did not pass a syntax check.

Now according to me this is a valid email address but for some reason CSE is having difficulty with it.

How can make this work?

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3471
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch »

Hello,

You should use:
<a href="mailto:joe@nl.smoe.net">joe@nl.smoe.net</a>

That is the correct and standard format.

Please let me know if you have any more questions.
Image
Albert Wiersch

User avatar
kgish
Rank I - Novice
Rank I - Novice
Posts: 11
Joined: Sat Apr 02, 2005 3:34 am
Location: Gouda, The Netherlands
Contact:

Post by kgish »

Yes, but officially a valid email address can have the more extended form:

Code: Select all

name-text <local-part@domain>
so why won't CSE let me put it in a mailto?

When I use this sytax and click on it from within my browser, it not only pops up the mail client with the given email, but when I send the email it arrives without a hitch.

So it must be alright, or not? Just wondering is all.
"The heart has its reasons of which reason knows nothing." - Blaise Pascal, Pensées

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3471
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch »

kgish wrote:Yes, but officially a valid email address can have the more extended form:

Code: Select all

name-text <local-part@domain>
so why won't CSE let me put it in a mailto?

When I use this sytax and click on it from within my browser, it not only pops up the mail client with the given email, but when I send the email it arrives without a hitch.

So it must be alright, or not? Just wondering is all.
Hello,

I've never read or seen anywhere that that format can correctly be used in a mailto link. Just because it works in a certain browser doesn't mean it is correct and that it will work in other browsers. The safest and most reliable way to use a mailto link is simply href="mailto:user@domain.com". When you start to add things like subjects (?subject=Email Subject), etc, the reliability goes down and fewer browsers and email programs work with it. So while the format you stated may be a valid email format in some situations, it isn't a good idea to use that format in the case of a mailto link because a mailto link has a specific format that it should follow. Hope this helps.
Image
Albert Wiersch

User avatar
kgish
Rank I - Novice
Rank I - Novice
Posts: 11
Joined: Sat Apr 02, 2005 3:34 am
Location: Gouda, The Netherlands
Contact:

Post by kgish »

Alright, good enough. In the meantime I have also discovered that there is a checkbox where I can disable mailto syntax checking altogether. Thanks.
"The heart has its reasons of which reason knows nothing." - Blaise Pascal, Pensées

bbtw
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 2
Joined: Sat Jul 09, 2005 6:03 pm

Post by bbtw »

Hi !

I am looking for an e-mail address syntax validator.
Do you know where i could find it ?

Thanx for your helping !

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3471
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch »

bbtw wrote:Hi !

I am looking for an e-mail address syntax validator.
Do you know where i could find it ?

Thanx for your helping !
CSE HTML Validator checks email address for proper syntax, though it can't take a text file containing a list of them and check them. You'd have to contruct a web page with a bunch of mailto links and then use the link checker and/or validator to check the email addresses. Sounds like a good idea for a possible future addition. :-)
Image
Albert Wiersch

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3471
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch »

kgish wrote:Alright, good enough. In the meantime I have also discovered that there is a checkbox where I can disable mailto syntax checking altogether. Thanks.
Should someone want to disable email address syntax checking (though not recommended), the option to disable this feature is in Options->Validator Engine Options, Network tab.
Image
Albert Wiersch

User avatar
Lou
Rank V - Professional
Rank V - Professional
Posts: 282
Joined: Fri Jul 29, 2005 5:55 pm
Location: CO
Contact:

Post by Lou »

To all:
A little research to make sure we all understand the difference between the TO: "display name" name@domain line in an email, and <A href="mailto:name@domain"> in HTML (validated by CSE v7.00) and what might work in some browser.

:arrow: Stating in the beginning with {my words}:

"HTML 4.01 Specification"
W3C Recommendation 24 December 1999

In section "12.2 The A element" {page 149 in the attributes list is} href=uri[p 51].

Going to page 51 to find the definition of a URI:

6.4 URIs {page 51}
This specification uses the term URI as defined in [URI] [p.355] (see also [RFC1630]
[p.356] ).

Following to the list of references:

[URI] {page 355}
"Uniform Resource Identifiers (URI): Generic Syntax", T. Berners-Lee, R.
Fielding, L. Masinter, August 1998. Note that RFC 2396 updates [RFC1738]
[p.354] and [RFC1808] [p.354] .

[RFC1738] {page 354}
"Uniform Resource Locators", T. Berners-Lee, L. Masinter, and M. McCahill,
December 1994.

{I found RFC2396 at}
http://www.ietf.org/rfc/rfc2396.txt

Network Working Group T. Berners-Lee
Request for Comments: 2396 MIT/LCS
Updates: 1808, 1738 R. Fielding
Category: Standards Track U.C. Irvine
L. Masinter
Xerox Corporation
August 1998


Uniform Resource Identifiers (URI): Generic Syntax
...
1.3. Example URI
...
mailto:mduerst@ifi.unizh.ch
-- mailto scheme for electronic mail addresses

{We note here no display name}

{We found RFC1738 at}
http://www.ietf.org/rfc/rfc1738.txt

Network Working Group T. Berners-Lee
Request for Comments: 1738 CERN
Category: Standards Track L. Masinter
Xerox Corporation
M. McCahill
University of Minnesota
Editors
December 1994


Uniform Resource Locators (URL)

...
3.5. MAILTO

The mailto URL scheme is used to designate the Internet mailing
address of an individual or service. No additional information other
than an Internet mailing address is present or implied.

A mailto URL takes the form:

mailto:<rfc822-addr-spec>

where <rfc822-addr-spec> is (the encoding of an) addr-spec, as
specified in RFC 822 [6]. Within mailto URLs, there are no reserved
characters.

Note that the percent sign ("%") is commonly used within RFC 822
addresses and must be encoded.

Unlike many URLs, the mailto scheme does not represent a data object
to be accessed directly; there is no sense in which it designates an
object. It has a different use than the message/external-body type in
MIME.

{and finely to RFC822 to define addr-spec}

http://www.w3.org/Protocols/rfc822/

RFC822: Standard for ARPA Internet Text Messages

...
6. Address Specification
6.1. Syntax

address = mailbox ; one addressee
/ group ; named list

group = phrase ":" [#mailbox] ";"

mailbox = addr-spec ; simple address
/ phrase route-addr ; name & addr-spec

route-addr = "<" [route] addr-spec ">"

route = 1#("@" domain) ":" ; path-relative

addr-spec = local-part "@" domain ; global address

local-part = word *("." word) ; uninterpreted
; case-preserved

domain = sub-domain *("." sub-domain)

sub-domain = domain-ref / domain-literal

domain-ref = atom ; symbolic reference

{Note that the addr-spec does not contain a display-name like the TO: or FROM: do. This is long :roll: but specs are like that.}

Post Reply