• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Velocity Email Template

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have the following problem:
I've used Velocity to create email templates.In one of these templates i've text + image(inline) content.In the received email the text is visible but the image is not.I guess there is some issue with the path to the image file,but couldn't figure it out.My .vm file look something like this:

registration-confirmation.vm


Also following is addtional information :
EmailCompo is the name of my application

image file location is :EmailTest/src/com/mcs/mailer/img123.jpg

vm file location : EmailTest/src/com/mcs/mailer/reg-con.vm

Cheers,
Poonam
 
Poonam Kadu
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the .vm file i have referenced the image file as src="/EmailCompo/src/com/mcs/mailer/img123.jpg"

Thanks
Poonam.
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the image is in your servlet context path try this



add this logoImage to your map object which you pass to velocity template.

In template use ${logoImage}
 
Poonam Kadu
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mukhi,
Its not a web application so i will not be able to use ServletContext .I 've tried almost all options for the path of the image file but none worked . The html text content is visible but the image is not...

Thanks,
Poonam
 
Poonam Kadu
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Will
VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "com/mcs/mailer/registration-confirmation.vm", model) work if the vm file contains an image.

Thanks,
Poonam .
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic