Search code examples
emailurilanguage-lawyermailto

What are the parsed components of a mailto URI


An e-mail address is a valid URI when encoded using the mailto scheme:

 mailto:user@example.com

(See RFC 6068)

But how should that be parsed according to RFC 3986, the standard for Uniform Resource Identifier (URI): Generic Syntax?

  • Is the user name part of the e-mail address (user of mailto:user@example.com) the user name of the user info part?

  • Is the host-name part of the e-mail address (example.com of mailto:user@example.com) the host part?


Solution

  • Despite an e-mail address containing a user name and a host name, when encoded in a mailto URI, the e-mail address constitutes part of the path of the URI, and the user part and host part are considered empty. This is because the user, password (if it was present) and host would constitute the authority part of the URI, which must be preceded by "//".

    That is, if the 'mailto' URI scheme had mandated mailto://user@example.com rather than mailto:user@example.com, the parsing would be as expected. A 'mailto' is thus, rather strangely, a URN.