'Send an image in the mail using thymeleaf
In my application I would want to send emails using javamail. I use Thymeleaf so that I can send some data. When sending the email, I want the background to be an image.
To achieve this, I added an img
tag to the HTML code with a relative src
, but when the email arrives in the target mailbox, the image does not open. I stored the image in a folder in the same directory as the html file.
What could be the problem? I did not add any attributes in java mail properties for image processing, should I? If so, what properties exactly?
Below you can find my HTML Thymeleaf template:
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<body>
<p style="text-align:center;">
<img src="image/valayev.jpg"
width="400"
height="400" class="center"
alt="should open">
</p>
</body>
</html>
This is the result:
And this is my folder structure:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|