code: public void embed(URL url, String cid, String name) throws EmailException {
  	// verify that the URL is valid
  	try {
  	    InputStream is = url.openStream();
  	    is.close();
  	}
  	catch (IOException e) {
  	    throw new EmailException("Invalid URL");
  	}
  
  	MimeBodyPart mbp = new MimeBodyPart();
  
  	try {
  	    mbp.setDataHandler(new DataHandler(new URLDataSource(url)));
  	    mbp.setFileName(name);
  	    mbp.setDisposition("inline");
  	    mbp.addHeader("Content-ID", "<" + cid + ">");
  	    this.inlineImages.add(mbp);
  	}
  	catch (MessagingException me) {
  	    throw new EmailException(me);
  	}
      }
docs: Embeds an URL in the HTML.
  
  <p>
  This method allows to embed a file located by an URL into the mail body. It allows, for instance,
  to add inline images to the email. Inline files may be referenced with a <code>cid:xxxxxx</code>
  URL, where xxxxxx is the Content-ID returned by the embed function.
  
  <p>
  Example of use:<br>
  <code><pre>
  HtmlEmail he = new HtmlEmail();
  he.setHtmlMsg("&lt;html&gt;&lt;img src=cid:" +
  embed("file:/my/image.gif","image.gif") +
  "&gt;&lt;/html&gt;");
  // code to set the others email fields (not shown)
  </pre></code>
  
  @param url The URL of the file.
  @param cid A String with the Content-ID of the file.
  @param name The name that will be set in the filename header field.
  @throws EmailException when URL supplied is invalid also see javax.mail.internet.MimeBodyPart for
  definitions