in src/main/java/org/apache/commons/mail/HtmlEmail.java [459:488]
public String embed(final DataSource dataSource, final String name, final String cid)
throws EmailException
{
if (EmailUtils.isEmpty(name))
{
throw new EmailException("name cannot be null or empty");
}
final MimeBodyPart mbp = new MimeBodyPart();
try
{
// URL encode the cid according to RFC 2392
final String encodedCid = EmailUtils.encodeUrl(cid);
mbp.setDataHandler(new DataHandler(dataSource));
mbp.setFileName(name);
mbp.setDisposition(EmailAttachment.INLINE);
mbp.setContentID("<" + encodedCid + ">");
final InlineImage ii = new InlineImage(encodedCid, dataSource, mbp);
this.inlineEmbeds.put(name, ii);
return encodedCid;
}
catch (final MessagingException uee)
{
throw new EmailException(uee);
}
}