Ok got it sorted. The solution is very simple, in your template you just
do:

<img src="${asset:image.jpg}"

and MailMessagePreparer automatically constructs a multi-part message.

V useful!




On Fri, 2011-04-15 at 15:48 +0100, Richard Hill wrote:
> Hi,
> 
> We're using MailMessagePreparer to add a RenderedStream to
> javax.mail.Message.
> 
> It works great, our page is being appended to the Message no problem.
> However there are images in the page, and I need to get these embedded
> in the message. At the moment this is what we're doing (semi-pseudo code
> for brevity):
> 
>         TemplateRenderer renderer =
> templateAPI.createRenderer("SummaryEmailTemplate", "en", "default");
>         RenderedStream renderedStream = renderer.render();
> 
>       Message message = new MimeMessage(session);
> 
>         message.setFrom();
>         // ... add recipients etc ...
>         
>         MailMessagePreparer.prepareMessage(message, renderedStream);
> 
>         Transport.send(message);
> 
> To add images I need to construct a multi-part message, where I add
> content to each MimeBodyPart (html to one part, images to the other).
> The prepareMessage() method only takes a Message as arg, not a
> MimeBodyPart, so I am not sure how to go about constructing my message
> using prepareMessage() to add the html part, distinct from the images
> part. 
> 
> Any advice on how to construct a multi-part message with images?
> 
> Thanks Richard. 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to