2010-02-02 56 views
22

我試圖弄清楚一個電子郵件地址的格式是否可以說符合URI的定義,但我沒有發現到目前爲止對此的明確確認。我希望有人能在這裏爲我提供一些見解。與 「電子郵件地址」 方案中使用時,在此先感謝:)電子郵件地址是一個URI嗎?

回答

34

是的,但 「電子郵件地址:」 方案前綴。

的URI具有這種形式:

<scheme>:<scheme-specific-part> 

<scheme>是 「電子郵件地址」,則<scheme-specific-part>是地址。

例如:

mailto:[email protected] 

是一個有效的URI。

+1

因此,如果沒有'mailto:'方案,電子郵件地址不能被視爲一個URI? – SarahofGaia 2016-04-29 17:37:53

2

是的,看看這裏: http://www.ietf.org/rfc/rfc2396.txt

1.3。示例URI

以下示例說明常用的URI。

至mailto:[email protected]
- 郵寄地址的電子郵箱地址

+0

這是不好的信息 – 2010-02-02 14:37:31

+0

rfc的1.3節有一個電子郵件示例 – ron 2010-02-02 14:37:48

+0

1.3示例URI --- – 2010-02-02 14:37:59

5

自己的電子郵件地址 - [email protected] - 我會說不。 鏈接到一個電子郵件地址 - mailto:[email protected] - 我會說是的。

+0

一個URI不需要包含scheme部分('mailto')是有效的。 – McDowell 2010-02-02 14:42:26

+0

我認爲「mailto」部分是強制性的。 – 2010-02-02 14:48:57

+0

@Massimo Fazzolari - 是的,你是對的 - 我錯了 - RFC 3986的ABNF需要一個方案。 – McDowell 2010-02-02 14:59:06

12

RFC 3986

統一資源標識符(URI)是 字符的緊湊序列 標識一個抽象或物理資源 。

由RFC定義的基本語法組件:

The generic URI syntax consists of a hierarchical sequence of 
components referred to as the scheme, authority, path, query, and 
fragment. 

    URI   = scheme ":" hier-part [ "?" query ] [ "#" fragment ] 

    hier-part = "//" authority path-abempty 
      /path-absolute 
      /path-rootless 
      /path-empty 

所以 - 電子郵件地址不是URI。但是mailto:[email protected]是一個有效的URI。

1

我覺得是,如果包括「電子郵件地址:」在地址模式的參考;否則不。但由於它只能在html頁面看到,在大多數情況下,它自身的電子郵件地址不能被視爲URI。

如果您之前沒有檢查過,請看RFC3305 document

URI方案名稱的正式登記由IANA在http://www.iana.org/assignments/uri-schemes.html

保持我希望它能幫助, 卡洛斯。

相關問題