Sending emails with images with images from the Spring MVC application

I am wondering what is the best way to send emails with images from them using the Spring MVC application using Velocity.

The image should be in the application, possibly in the same place as the template *.vm(for example src/main/resources/templates), and absolute paths should not be used (for example, C: \ App ...), so I can not understand how to do this.

Suggestions?

+3
source share
2 answers

You need to understand how images and emails work. I'm not an expert here, but I think the options

  • (lame, IMHO, ).
  • HTML- ,

org.springframework.mail.javamail.MimeMessageHelper

+4

Spring ( jar) . Resource , FileSystemResource ClasspathResource. :

Resource fileResource = new FileSystemResource("resources/templates");

.

, bean, Resource:

<bean id="mailer" class="test.Mailer">
    <property name="templateResource" value="file:resource/templates" />
</bean>

Velocity, , freemarker. .

+2

All Articles