I am using Velocity Transformer email template with my Mule smtp. Is there any ways that I can add images in the email templates from my classpath ? That is for example .. if I have an image say abc.png in my classpath, can I able to use it in my velocity email template like < image src= ......
相关问题
- Django & Amazon SES SMTP. Cannot send email
- How to add sender name before sender address in py
- Velocity Unable To find Resources
- Font-Size in HTML Email via Gmail
- TCL Email Script doesn't deliver in Activestat
相关文章
- c#发送邮件,附件损坏
- com.sun.mail.smtp.SMTPSenderFailedException: 550 5
- Getting velocity error at statup “VM_global_librar
- Outlook SMTPClient server error 5.3.4 5.2.0
-
553 5.7.1
: Sender address rejected: not - Is there a way to debug Velocity templates in the
- How to disable velocity logs
- Velocity templates seem to fail with UTF-8
I had followed your code to add image path in the velocity transformer in the following way, the String logo will get the value from spring beans
You can add outbound attachments to the Mule Message, using classpath resources as their source. These Mule Message attachments will be turned into MIME parts by the SMTP outbound transformer.
From the discussion here Embedding images into html email with java mail it seems you need to declare the images like this:
You have to use a unique ID after cid: that is consistent with the Content-ID part header. Mule allows you to specify custom part headers by adding an outbound message property java.util.Map named attachmentName+"Headers" (attachmentName is the name of the outbound attachment).
One potential difficulty is that the code in the
ObjectToMimeMessage
transformer that takes care of transforming a thejavax.activation.DataHandler
(coming from the Mule Message outbound attachment) in ajavax.mail.BodyPart
only callssetFileName
but notsetDisposition
which I think is needed for the image to show properly. This said, I'm not an expert here, you probably know more about properly generating MIME emails with attached images.1) Embed the image Base64 encoded in your HTML e.g.
Use following site to convert image to base64: http://www.dailycoding.com/Utils/Converter/ImageToBase64.aspx