SMTP電子郵件格式及源碼解析

來源:互聯網
上載者:User

SMTP協議之電子郵件格式

以下是使用FOXMAIL內送郵件後,得到的郵件源碼,包括本文和兩個附件(.JPG, .TXT):

----------------------------------------------------------------

以下部分為郵件伺服器添加的郵件標頭

----------------------------------------------------------------

Received:from m15-17.126.com (unknown [220.181.15.17])

         bymx10 (Coremail) with SMTP id PMCowECZWSfPlodRSu6NCw--.779S2;

         Mon,06 May 2013 19:41:03 +0800 (CST)

DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; // 網域名稱金鑰指定郵件標準,判斷垃圾郵件

         s=s110527;h=Received:Date:From:To:Subject:Content-Type:

         MIME-Version:Message-ID; bh=B57Zfi/+wCVQ61kM9GVkCECk1ax4OZVQDtnW // 不是base64編碼

         T4lS0x8=;b=XdeYidC7bR1a1l7x3yGAMiMR5ElDx2O4/db2iPrVc0dZ7Y7ANStu     // 不是base64編碼

         6d9o4l9yVysfwk8vifb0eqyxV2wp28pIlfLEGZbDDpKaLMCaLAbVXdW+2hQl4ojd    // 不是base64編碼

         sJ7NiAdF1j5X2N87wktFKA8ZK4lPhBYI1yFrNIT+PODg2NzF1CX2FDM=

Received: from zzzzyy91$126.com ( [202.205.103.22] ) by ajax-webmail-wmsvr17

 (Coremail) ; Mon, 6 May 2013 19:41:01 +0800(CST)

X-Originating-IP: [202.205.103.22]                //初始ip地址,同一電腦不同郵箱發郵件,該值相同

---------------------------------------------------------------------------------------------------------

DATA(以下內容由郵件用戶端定義,為DATA命令後輸入的內容)

灰色高亮為主要內容

--------------------------------------------------------------------------------------------------------

 

Date: Mon, 6 May2013 19:41:01 +0800 (CST)

From: [base64code]<zzzzyy91@126.com>

To: [emailaddress]

Subject: [base64 code]

X-Priority: [integer]                                          // 郵件優先順序

X-Mailer: [Coremail Webmail Server Version SP_ntes V3.5 build      // 代理髮信用戶端

 20130412(21945.5326.5325) Copyright (c)2002-2013 www.mailtech.cn 126com]

X-CM-CTRLDATA: [base64 code]                           // X-郵件伺服器自訂的資訊段,未知作用

Content-Type:multipart/mixed;                               // 聲明郵件內容格式

         boundary="----=_Part_354288_309861106.1367840461937"    // 聲明郵件內容boundary

MIME-Version: 1.0                                          // 聲明MIME版本

Message-ID: <>                                             // X-郵件伺服器自訂的資訊段

X-CM-TRANSID:                                             //X-郵件伺服器自訂的資訊段

X-CM-SenderInfo:                                           // X-郵件伺服器自訂的資訊段

X-Coremail-Antispam:                                       // X-郵件伺服器自訂的資訊段

 

---------------------------------------------------------

以下為郵件的內容

黃色高亮部分為內容說明語句和定界符

綠色高亮部分為郵件內容

藍色高亮部分為附件內容

--------------------------------------------------------

 

------=_Part_354288_309861106.1367840461937                 //郵件內容開始

Content-Type: multipart/alternative;                           //郵件內容格式

         boundary="----=_Part_354290_1105600126.1367840461937" // 郵件內文boundary

 

------=_Part_354290_1105600126.1367840461937              //郵件內文boundary -- 本文開始

Content-Type: text/plain; charset=GBK                        // 郵件內文格式和字元集

Content-Transfer-Encoding: base64

 

[base64]mailcontent (plain)[base64]                         //郵件內文(文字格式設定)編碼(base64)

 

------=_Part_354290_1105600126.1367840461937              // 郵件內文boundary  --可選HTML格式

Content-Type: text/html; charset=GBK                        //郵件內文格式和字元集

Content-Transfer-Encoding: base64

 

[base64]mailcontent (html)[base64]                         //郵件內文(html格式)編碼(base64)

 

------=_Part_354290_1105600126.1367840461937--           // 郵件內文boundary -- 本文結束

 

 

------=_Part_354288_309861106.1367840461937             // 郵件內容boundary -- 附件1開始

Content-Type: image/jpeg; name="20130324_224528_982.jpg" // 附件格式及檔案名稱

Content-Transfer-Encoding: base64

Content-Disposition: attachment;filename="20130324_224528_982.jpg"

 

[base64](.jpg)image attachment[base64]                         //附件-圖片內容編碼(base64)

 

------=_Part_354288_309861106.1367840461937                  // 郵件內容boundary -- 附件2開始

Content-Type: text/plain; name="window data type.txt"            // 附件格式及檔案名稱

Content-Transfer-Encoding: base64

Content-Disposition: attachment; filename="window datatype.txt"

 

[base64](.txt)plain attachment[base64]                         // 附件-常值內容編碼(base64)

 

------=_Part_354288_309861106.1367840461937--                // 郵件內容boundary  -- 附件結束

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.