Since you came here, you are properly holding a piece of HTML from a message which contains an embedded image.
An example could be this HTML snippet:
<img alt="" src="cid:email@example.com" height="375" width="300">
Notice the src attribute value: cid:firstname.lastname@example.org
You should notice that the protocol specifier is not HTTP but is instead cid
. This stands for C
So the src attribute cid:email@example.com
is specifying that the image is embedded in the email, and the part you should look for has a Content-ID of firstname.lastname@example.org
This means that such a part should exist in the email, and it might look like this:
Content-Type: image/jpeg; name="image.jpg"
Notice that the Content-ID of the part is equal to the src attribute of the image.
Therefore, to extract an image you need to to find the MessagePart with the correct Content-ID.
When you have that Messagepart, you can save it to disk using the Save method.