// Set Html body. It also contains <img> tag with cid. cid = LinkedResource.ContentID
message.setHtmlBody("<b>This line is in bold.</b> <br/> <br/>"
+ "<font color=blue>This line is in blue color</font><br><br>" +
"Here is an embedded image.<img src=cid:companylogo>");
// Add linked resource
LinkedResource res = new LinkedResource(dataPath + "Aspose.png", MediaTypeNames.Image.PNG);
res.setContentId("companylogo");
// Add Linked resource to the message’s Linked resource collection
message.getLinkedResources().addItem(res);
Download Source Code