Re: [gmime-devel] Email attachment, body parsing via GMime on Java



On 02/08/2011 09:52 AM, Sharma, Ashish wrote:
> Hi,
>
> I am using a small java smtp library (http://code.google.com/p/subethasmtp/), by this I need to parse the incoming emails in separate file components viz body, attachments etc.
>
> I am trying to use GMime library in my Java code. Has anybody tried this already. 
>   

I have a bad feeling no one else has tried this :-(

> If yes then please share your experience.
>
> If no, can somebody please guide me what are the requirements and interfaces that I can use for writing JNI for GMime.
>   

I'd probably start by talking with the Java-GNOME bindings developer(s)
and finding out if they have a tool or some docs on how to write Java
bindings for gtk-style libraries. I'm sure they must. The Mono/C#
bindings are all auto-generated (with only a few minor tweaks).

> I need an approach that takes in the smtp data stream and returns me with an array of attachment references or streams in fully parsed out form in java. Please help.
>   

I guess the first step is binding GMime to Java. After that, the best
place to look for an example on how to use GMime's parser is in the
source tarball under examples/basic-example.c or
examples/imap-example.c, both of which will show you how to loop over
the MIME parts in a GMimeMessage - what you decide is the "body" is
really up to you, but there is some simplistic logic here:

http://git.gnome.org/browse/gmime/tree/gmime/gmime-message.c#n1576

For your convenience, the examples can be found on the web too:

http://git.gnome.org/browse/gmime/tree/examples?h=gmime-2-4


If you have any more questions, feel free to ask.

Good luck on your project,

Jeff



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]