Hi,
I have a need to serialize Message objects.
So I thought of extending MimeMessage and serializing it(by implementing java.io.Serializable interface).
Is it fine to serialize the Message object?
To me, it looks like there may be some reason why Message class (or for that matter MimeMessage) didn't implement Serializable interface.
Hi,
Now I have the same problem, need to serialize javax.mail.internet.MimeMessage.
I tried your idea before, extended the MimeMessage class and implementing the Serializable interface. It doesn't work.
Have you found solution since ?
I should greatly appreciate if you could help.
Hi,This is Avanish from MNC software bangalore..developing similar functinality of sending MIME message object throgh serialization..i Guess by implementing the Serializable we can serialize and send the object but the problem is It loses some of its envelop and header information from tthe mail...If any one is able to send the serialized MIME MEssage withous lose of nay information please let me ASAP...
thanks and regards...pleaze let me know how can i help you more...
reply me immediately at bloom122@yahoo.com
Any further discussion or clarification at yahoo messenger at bloom122@yahoo.com id..
hope to see ur quite response ASAp.
Avanish
Hi,This is Avanish from MNC software bangalore..developing similar functinality of sending MIME message object throgh serialization..i Guess by implementing the Serializable we can serialize and send the object but the problem is It loses some of its envelop and header information from tthe mail...If any one is able to send the serialized MIME MEssage withous lose of nay information please let me ASAP...
thanks and regards...pleaze let me know how can i help you more...
reply me immediately at bloom122@yahoo.com
Any further discussion or clarification at yahoo messenger at bloom122@yahoo.com id..
hope to see ur quite response ASAp.
Avanish
// on the client side
MimeMessage mimemessage = new MimeMessage((javax.mail.Session)null);
// do what you need
...
// put the content of mimemessage into encoded String what is Serializable
ByteArrayOutputStream baos = new ByteArrayOutputStream();
message.writeTo(baos);
byte[] bytearray = baos.toByteArray();
Base64Encoder encoder = new Base64Encoder();
String base64encodedmessage = encoder.encode(bytearray);
// On the server side
// decode the received string
Base64Decoder decoder = new Base64Decoder();
byte[] bytearray = decoder.decodeBuffer(base64encodedmessage );
ByteArrayInputStream bais = new ByteArrayInputStream(bytearray);