2011-12-28 20 views
2

是否有任何可用的电子邮件解析器库或实现教程(没有JavaMail API)解析休耕格式的消息以获取它们的字段,如FROM/SUBJECT/etc?没有JavaMail的Java POP3消息解析器API

我想解析这些消息的文本文件,这些消息是通过我的应用程序中的POP3协议接收的,并最终将它们显示在html文件中。

样本消息:

-------------------- messsage 1, size=4234 -------------------- 
Return-path: <[email protected]> 
Received: from mail-iy0-f171.google.com (mail-iy0-f171.google.com [209.85.210.171]) 
    by xxxmail.com (xxxmail.com) 
    (MDaemon PRO v11.0.0) 
    with ESMTP id md50000000053.msg 
    for <[email protected]>; Mon, 12 Dec 2011 22:55:39 +0330 
Authentication-Results: xxxmail.com 
    spf=pass [email protected]; 
    x-ip-ptr=pass dns.ptr=mail-iy0-f171.google.com (ip=x.x.x.x); 
    x-ip-helo=pass smtp.helo=mail-iy0-f171.google.com (ip=x.x.x.x); 
    x-ip-mail=hardfail [email protected] (does not match x.x.x.x); 
    x-vbr=hardfail header.vbr-info=gmail.com (domain not recognized); 
    dkim=pass header.d=gmail.com (b=Cv+42gRZMW; 1:0:good); 
Received-SPF: pass (xxxmail.com: domain of [email protected] 
    designates x.x.x.x as permitted sender) 
    x-spf-client=MDaemon.PRO.v11.0.0 
    receiver=xxxmail.com 
    client-ip=x.x.x.x 
    envelope-from=<[email protected]> 
    helo=mail-iy0-f171.google.com 
X-Spam-Processed: xxxmail.com, Mon, 12 Dec 2011 22:55:39 +0330 
    (not processed: sender in recipient's private address book) 
X-MDPtrLookup-Result: pass dns.ptr=mail-iy0-f171.google.com (ip=x.x.x.x) (xxxmail.com) 
X-MDHeloLookup-Result: pass smtp.helo=mail-iy0-f171.google.com (ip=x.x.x.x) (xxxmail.com) 
X-MDMailLookup-Result: hardfail [email protected] (does not match x.x.x.x) (xxxmail.com) 
X-MDDKIM-Result: unapproved (xxxmail.com) 
X-MDVBR-Result: not certified (xxxmail.com) 
X-MDSPF-Result: unapproved (xxxmail.com) 
X-Rcpt-To: [email protected] 
X-MDRcpt-To: [email protected] 
X-MDRemoteIP: x.x.x.x 
X-Return-Path: [email protected] 
X-Envelope-From: [email protected] 
X-MDaemon-Deliver-To: [email protected] 
Received: by iaen33 with SMTP id n33so35124825iae.30 
     for <[email protected]>; Mon, 12 Dec 2011 11:28:52 -0800 (PST) 
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; 
     d=gmail.com; s=gamma; 
     h=mime-version:in-reply-to:references:date:message-id:subject:from:to 
     :content-type; 
     bh=SZ4ok7NaD3MuwvPJVzJAtsCaqSMeAJJ6Kq3AFI1elK8=; 
     b=Cv+42gRZMW8gRSzCX11ToY/EnHTqzO2E5cWkJsnwj6JCapz5GXG2iIadjBkHyKuGkE 
     i5cjPQyZXhHBg9ZfKRaWViSMqiaySvak7WA+yVf65JB2zEHykysFHbqbfPLG2CaRxXHi 
     PVfJVURd5MHCLpSyCxeW25slIBOBqpWabuWj4= 
MIME-Version: 1.0 
Received: by 10.42.151.68 with SMTP id d4mr13014719icw.36.1323718132412; Mon, 
12 Dec 2011 11:28:52 -0800 (PST) 
Received: by 10.43.49.67 with HTTP; Mon, 12 Dec 2011 11:28:52 -0800 (PST) 
In-Reply-To: <[email protected]> 
References: <[email protected]> 
Date: Mon, 12 Dec 2011 11:28:52 -0800 
Message-ID: <[email protected]om> 
Subject: Re: Hi :D 
From: y y <[email protected]> 
To: [email protected] 
Content-Type: multipart/alternative; boundary=90e6ba6e872e10b18504b3ea252a 
X-Antivirus: avast! (VPS 111228-0, 12/28/2011), Inbound message 
X-Antivirus-Status: Clean 

--90e6ba6e872e10b18504b3ea252a 
Content-Type: text/plain; charset=UTF-8 
Content-Transfer-Encoding: quoted-printable 

=D8=A7=D9=84=D9=84=D9=87 =D9=88=D8=A7=D9=82=D8=B9=D9=86 =D8=A7=DA=A9=D8=A8= 
=D8=B1=D9=87 :=D8=AF=DB=8C 

On Mon, Dec 12, 2011 at 12:00 AM, <[email protected]> wrote: 

> Hi! this is the main text of the message :) 
> 
> 
> 
+0

评论已删除。对于那个很抱歉。 – Stu 2011-12-28 23:24:28

+0

我已经完成了JavaMail.Now我只想知道是否还有其他解决方案 – 2011-12-30 13:10:24

+0

JavaMail是GPL v2,一种病毒许可证。我还没有找到免费的非病毒许可的Java的MIME解析库。呃,人们为什么要做GPL? – 2013-02-13 19:58:51

回答