When attaching an image to a MIME multipart mail (either multipart/related or multipart/mixed), you can give the image a Content-Id header with an arbitrary cid value.
In the HTML body of your mail, you can then reference those cids again to display images.