You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Ioan Eugen Stan <st...@gmail.com> on 2012/02/23 09:58:37 UTC

Re: Persist IMAP messages

Pe 23.02.2012 09:00, Jentu Jain a scris:
> Hi,
> I want to persist the emails that are moved to IMAP mailbox to another application's database as a file. What should be the format of the file that would hold the message so that it can be saved/retrieved to/from the application?
>
> Regards
> ------------------------------------
> Jentu Jain | Datacert, Inc.
>
> Why are major companies rapidly migrating to Passport?  Find Out Here<http://www.datacert.com/>
> [Description: cid:image001.gif@01CBF2C7.283B26D0]<http://www.datacert.com/feed.xml>[Description: cid:image002.gif@01CBF2C7.283B26D0]<http://twitter.com/datacert>
>
>

Hi Jentu,

I think the best way to save the message is in it' original form, as a 
standard Internet message format (http://tools.ietf.org/html/rfc2822).
You can get the original stream of bytes (Message object has a 
getContent method and getBody() that provide InputStream's) and you can 
persist them.

You can then use mime4j to parse the message and get the parts that you 
wish. Either dynamic, on request, or save offsets for each part of the 
message (the message does not change). Depends on your needs but the 
first should be all you need.

Cheers,

-- 
Ioan Eugen Stan
http://ieugen.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


RE: Persist IMAP messages

Posted by Jentu Jain <je...@datacert.com>.
Thanks Stan. This works.
I want to know the callbacks that should be overridden in order to 
1) Populate the messages from another application just once and
2) save the message into another application whenever a message(other than the ones that were pre-populated) is dropped into a folder.

Regards
------------------------------------
Jentu Jain | Datacert, Inc.

Why are major companies rapidly migrating to Passport?  Find Out Here


-----Original Message-----
From: Ioan Eugen Stan [mailto:stan.ieugen@gmail.com] 
Sent: Thursday, February 23, 2012 2:29 PM
To: server-user@james.apache.org
Subject: Re: Persist IMAP messages

Pe 23.02.2012 09:00, Jentu Jain a scris:
> Hi,
> I want to persist the emails that are moved to IMAP mailbox to another application's database as a file. What should be the format of the file that would hold the message so that it can be saved/retrieved to/from the application?
>
> Regards
> ------------------------------------
> Jentu Jain | Datacert, Inc.
>
> Why are major companies rapidly migrating to Passport?  Find Out 
> Here<http://www.datacert.com/>
> [Description: 
> cid:image001.gif@01CBF2C7.283B26D0]<http://www.datacert.com/feed.xml>[
> Description: 
> cid:image002.gif@01CBF2C7.283B26D0]<http://twitter.com/datacert>
>
>

Hi Jentu,

I think the best way to save the message is in it' original form, as a standard Internet message format (http://tools.ietf.org/html/rfc2822).
You can get the original stream of bytes (Message object has a getContent method and getBody() that provide InputStream's) and you can persist them.

You can then use mime4j to parse the message and get the parts that you wish. Either dynamic, on request, or save offsets for each part of the message (the message does not change). Depends on your needs but the first should be all you need.

Cheers,

--
Ioan Eugen Stan
http://ieugen.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org