You can serve them just as you would any other image. Just set the src attribute of the img tag to point to the script which generates the image.
You can try hosting the images on a server, and then changing the image in that url with something else, however some email clients pre-download the images to avoid viruses.