2012/3/21 Saibabu Vallurupalli <[email protected]>: > Hi Ioan, > > My name is Sai :-)
Hi, I noticed the mistake just after sending, sorry about that. > Also, I am aware of the code you pointed to me any ways Thank you. I wrote > JPAEncryptedMessage.java :-) > > What I am looking for is how to extract just attachment from body content > BLOB without any code modifications to James source. > > Please let me know if you have any ideas? > > Thanks, Sai. Well, you can't do a job and not have your hands dirty ;). I can't seem to think how you could do that besides a mailet or an external tool that accesses the database and processes the messages. I would go with a mailet, should be pretty easy to implement mime parsing there. > > On Tue, Mar 20, 2012 at 6:56 PM, Ioan Eugen Stan <[email protected]>wrote: > >> 2012/3/20 Saibabu Vallurupalli <[email protected]>: >> > Hi Eric, >> > >> > We are trying to retrieve it after storing to make it more simple. During >> > process might need a code change in mailets I guess. >> > If it is a completed email in BLOB, is there a way to extract just >> > attachment? >> > >> > Thanks, Sai >> > >> >> Hello Say, >> >> You will have to load the email and use mime4j to process it and >> extract attachments. The code that maps one message to a database >> table is in JPAMessage class [1]. If you look closely, you will see >> the JPA annotations for headers and body like bellow. JPAMessage class >> has getBodyContent and getHeaderContent methods to get an InputStream >> for each value. >> >> 5 /** The value for the body field. Lazy loaded */ >> 46 /** We use a max length to represent 1gb data. Thats prolly >> overkill, but who knows */ >> 47 @Basic(optional = false, fetch = FetchType.LAZY) >> 48 @Column(name = "MAIL_BYTES", length = 1048576000, nullable = false) >> 49 @Lob private byte[] body; >> >> 52 /** The value for the header field. Lazy loaded */ >> 53 /** We use a max length to represent 1gb data. Thats prolly >> overkill, but who knows */ >> 54 @Basic(optional = false, fetch = FetchType.LAZY) >> 55 @Column(name = "HEADER_BYTES", length = 10485760, nullable = false) >> 56 @Lob private byte[] header; >> >> >> [1] >> http://svn.apache.org/viewvc/james/mailbox/trunk/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAMessage.java?view=markup >> >> > On Tue, Mar 20, 2012 at 3:23 PM, Eric Charles <[email protected]> wrote: >> > >> >> Hi Sai, >> >> If you use JPA, the complete mail is stored as a blob in the >> JAMES_MESSAGE >> >> table (see http://james.apache.org/**server/3/images/database/** >> >> james-database-schema-derby_**1000.png< >> http://james.apache.org/server/3/images/database/james-database-schema-derby_1000.png>for >> an old version of the schema). >> >> >> >> Are you looking to extract it when processing the mail in a mailet, or >> >> extract afterwards when already stored in the database? The >> implementations >> >> will be quite different depending on your need. >> >> >> >> Thx, Eric >> >> >> >> >> >> >> >> On 20/03/12 20:00, Saibabu Vallurupalli wrote: >> >> >> >>> Hi Team, >> >>> >> >>> At present I have a requirement to extract the email attachment and put >> >>> them in a separate folder for different use. >> >>> >> >>> What is the best way to do this? Does the attachments are stored in >> MySQL >> >>> database? >> >>> >> >>> Any inputs on this will be really helpful. >> >>> >> >>> Thank you, >> >>> Sai >> >>> >> >>> >> >> -- >> >> eric | http://about.echarles.net | @echarles >> >> >> >> >> ------------------------------**------------------------------**--------- >> >> To unsubscribe, e-mail: server-dev-unsubscribe@james.**apache.org< >> [email protected]> >> >> For additional commands, e-mail: [email protected].**org< >> [email protected]> >> >> >> >> >> >> >> >> -- >> Ioan Eugen Stan >> http://ieugen.blogspot.com/ >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> -- Ioan Eugen Stan http://ieugen.blogspot.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
