Reputation: 15
How do i send an email where the body is an html file that the user choses in the (Fileupload) and the html file has images?
i want to embed the images in the body.
Upvotes: 0
Views: 369
Reputation: 63964
The most general way to embed images in html is by converting the image bytes to base64 string and setting the src
property of the img element to be the base64 string.
For example, you can construct HTML as follows:
<img src="data:image/gif;base64,R0lGODlhDwAPAKECAAAAzMzM/////
wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLlN48CXF8m2iQ3YmmKqVlRtW4ML
wWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw=="
alt="Base64 encoded image" width="150" height="150"/>
You, of course, need to convert the image bytes to base64 encoding. Example:
string base64String = Convert.ToBase64String(imageBytes);
Upvotes: 0
Reputation: 3951
If you are asking how to include images in an email, try this page: http://www.systemnetmail.com/faq/4.4.aspx
Upvotes: 3