On 16/01/2008, LeeZ01 <[EMAIL PROTECTED]> wrote:
>
> I need to send email with attachment from producer server to a consumer
> server. On the producer server, a file (PDF, MS Doc, etc.) is loaded as
> attachment, together with addressTo, addressFrom, subject, etc. are sent to
> ActiveMQ. The consumer server needs to grab all those contents, forms a
> javax.mail.Message object, and transport that mail message to its
> destinations.
>
> On the producer server side, I have MyMessage like:
>
> public class MyMessage implements Serializable {
> static final long serialVersionUID = 4916853063597487545L;
> private String addressTo;
> private String addressFrom;
> private String text;
> private byte[] attachment;
> private String subject;
> private Vector cc;
> //Bean methods follows.
> }
> Is it okey to load the file into the byte[] array attachment and send the
> object to ActiveMQ?
You could yes. Given its Serializable, you could use an ObjectMessage ?
> If okey, could someone show me code snipet on the consumer server side to
> form a MultiPart java mail message using MyMessage bean?
MyMessage message = (MyMessage) objectMessage.getObject();
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://open.iona.com