我嘗試着直到現在使用JavaMail API創建類型爲MimeMessage
的對象,並在此之後獲取其原始表示,但沒有成功。我唯一可以獲得的是電子郵件的內容的原始表示,但標題,主題或收件人未包括在內。我感興趣的任何建議,任何Java庫,可以幫助我創建一個電子郵件對象,並在此之後獲得其原始表示。原始的表現應該是這個樣子:使用java將電子郵件轉換爲其原始格式
received: from imta14.emeryville.ca.mail.myisp.net ([nn.nn.30.46])
by alnrmxc19.isp.net (alnrmxc19) with ESMTP
id <20080930215116a19007q9u6e>; Tue, 30 Sep 2008 21:51:16 +0000
X-Originating-IP: [nn.nn.30.46]
Received: from libertatea.go ([nn.nn.161.160])
by IMTA14.mail.isp.net with isp
id M9qy1a00V3TwUto0E9rELB; Tue, 30 Sep 2008 21:51:15 +0000
X-Authority-Analysis: v=1.0 c=1 a=DZlucjOqAY8A:10 a=mnGO974OAAAA:8
a=9MJFf195B83LjESASTQA:9 a=Lm7NQ261g8eJHgoaELoA:7
a=7Narey355jFQWZRww2lj1r9-lCkA:4 a=8COHQAuY8ZYA:10 a=zEVpGHA-kecA:10
a=37WNUvjkh6kA:10
Received: by libertatea.go id hm1nfa0di0sn for <[email protected]>; Sun,30 Sep 2018 09:36:35
+0300 (envelope-from <[email protected]>)
Message-ID: <[email protected]>
Date: Sun, 30 Sep 2018 09:36:35 +0300
From: "Hometown Quotes" <[email protected]>
To: [email protected]
Subject: Find Affordable Auto Insurance Today
MIME-Version: 1.0
X-UID: 79864795.modhnrfo.jhhnk.1
Content-Type: multipart/alternative; boundary="0-1411506895-1200484069=:66653"
Content-Transfer-Encoding: 8bit
X-PMFLAGS: 570966272 9 1 PE71PYHD.CNM
X-UC-Weight: [# ] 51
X-CC-Diagnostic: Test 'LazyHTML Tolerant' (51)
--0-1411506895-1200484069=:66653
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
--0-1411506895-1200484069=:66653
Content-transfer-encoding: 8bit
Content-Type: text/html; charset=iso-8859-1; DelSp="Yes"; format="flowed"
你到目前爲止試過了什麼?發佈您的代碼並詢問您遇到的具體問題。如果您需要它爲您編寫租用編碼器將在一個價格做它。 – RossC
好吧,所以我嘗試了Message.getInputStream()方法,它是返回原始內容的JavaMail API中唯一的方法,但它只返回消息的**內容**,不包含頭,主題等。我需要以原始格式獲取Message類型對象的所有內容。 – mihai