Add an inline element to the MimeMessage, taking the content from a
javax.activation.DataSource
.
Note that the InputStream returned by the DataSource implementation needs to be a fresh one on each call, as JavaMail will invoke getInputStream()
multiple times.
NOTE: Invoke addInline
after {@link #setText}; else, mail readers might not be able to resolve inline references correctly.
@param contentId the content ID to use. Will end up as "Content-ID" headerin the body part, surrounded by angle brackets: e.g. "myId" -> "<myId>". Can be referenced in HTML source via src="cid:myId" expressions.
@param dataSource the javax.activation.DataSource
to takethe content from, determining the InputStream and the content type
@throws MessagingException in case of errors
@see #addInline(String,java.io.File)
@see #addInline(String,org.springframework.core.io.Resource)