MIME 規格為內文部分定義了一組標頭行。包含 MIME-Version、Content-type、Content-Transfer-Encoding、Content-ID 和 Content-disposition。conversion 通道最常使用 Content-type 和 Content-disposition 兩個標頭。部分 MIME 標頭行的範例如下所示:
Content-type: APPLICATION/wordperfect5.1;name=Poem.wpc Content-transfer-encoding: BASE64 Content-disposition: attachment; filename=Poem.wpc Content-description: "Project documentation Draft1 wordperfect format" |
MIME 標頭行不同於一般的非 MIME 標頭行 (如 To:、Subject: 和 From:)。基本上,只要述及轉換通道,MIME 標頭行就會以字串 Content- 開頭。
MIME Content-Type 標頭說明內文部分的內容。Content-Type 標頭格式舉例如下:
Content-type: type/subtype; parameter1=value; parameter2=value...
type 說明內文部分的內容類型。type 範例有 Text、Multipart、Message、Application、Image、Audio 和 Video。
subtype 進一步說明內容類型。每個 Content-type 各自擁有一組 subtypes。例如:text/plain、application/octet-stream 和 image/jpeg。MIME 郵件的內容子類型由 IANA (網際網路指定號碼授權中心) 指定並列出。清單位於 http://www.iana.org/assignments/media-types。
parameter 特定於Content-type/subtype 對。例如,如下所示的 charset 和 name 參數:
Content-type: text/plain; charset=us-ascii Content-type: application/msword; name=temp.doc |
charset 參數指定文字郵件的字元集。name 參數在將資料寫入檔案時,為其指定建議使用的檔案名稱。
Content-Type 值、subtypes 和參數名稱都不區分大小寫。
MIME Content-disposition 標頭提供內文部分的展示資訊。它通常被增加到附件中,指定附件內文部分應顯示 (inline) 還是表示為檔案名稱以供複製 (attachment)。Content-disposition 標頭的格式如下:
Content-disposition: disposition_type; parameter1=value;parameter2=value...
disposition_type 通常為 inline (顯示內文部分) 或 attachment (表示為要儲存的檔案)。Attachment 通常具有參數 filename,值用於指定建議儲存檔案使用的名稱。
如需有關 Content-disposition 標頭的詳細資訊,請參閱 RFC2183。