in commons-email2-jakarta/src/main/java/org/apache/commons/mail2/jakarta/HtmlEmail.java [304:320]
public String embed(final DataSource dataSource, final String name) throws EmailException {
// check if the DataSource has already been attached;
// if so, return the cached CID value.
final InlineImage inlineImage = inlineEmbeds.get(name);
if (inlineImage != null) {
// make sure the supplied URL points to the same thing
// as the one already associated with this name.
if (dataSource.equals(inlineImage.getDataSource())) {
return inlineImage.getCid();
}
throw new EmailException("embedded DataSource '" + name + "' is already bound to name " + inlineImage.getDataSource().toString()
+ "; existing names cannot be rebound");
}
final String cid = EmailUtils.toLower(EmailUtils.randomAlphabetic(CID_LENGTH));
return embed(dataSource, name, cid);
}