Click here to Skip to main content
15,888,111 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hi, i used the following html, embedded css to send a html email. That email contains an image to be displayed with div element with help of embedded css style. I can't able to see image in the email client. Please refer below link to my html and css code.
http://codepen.io/anon/pen/mJxvPp?editors=100[^]
Posted
Updated 7-Jul-15 21:00pm
v2

1 solution

You will need to use content-type "text/html" for the whole e-mail or some of its parts in case of multi-part e-mail. CSS can be embedded exactly as in stand-along HTML.

Embedding an image is more tricky. You need to create a multi-part e-mail. Let's say, one part is the image, which has "Content-Disposition" other than inline ("attachment"). Its "Content-type" could be, say, "image/png" or any other image content type, depending on what it really is. Now, you need to reference this image in your HTML part. This is done using the special URI sheme "cid:".

Please see my past answers:
Sending HTML attachment with images[^],
How to attach a file in smtp mail implementation[^],
how can i send image with text in email in asp[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900