Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi together:-)

i have an application which can send emails...

now i want to put a bitmap file in an email (in the text, not in the attachment).

problem: i have no idea how to achieve this... (i am using mfc, c++, visual studio 10)

what i dont know for example:

- how are bitmaps stored in an email?
- do i have to convert it in a certain way?

i heard something about base64, has this anything to do with my problem?

does anyone know how to do this?

thx for your help:-)
Posted
Comments
Member 10781325 2-May-14 2:52am    
many thanks! i will try it with your references and i will post further questions/the solution!
i dont need a clickable reference, but just an image to watch at:-)

thank you!

1 solution

You don't need to add HTML. HTML is only needed if you want to have a clickable reference. In other cases, you just add a mail part with different content type. Please see:
http://en.wikipedia.org/wiki/Content_type[^].

The standardized list of types is supported here: http://www.iana.org/assignments/media-types/media-types.xhtml[^].

You need these types: http://www.iana.org/assignments/media-types/media-types.xhtml#image[^].

Now, you need to set proper content-disposition: http://www.iana.org/assignments/cont-disp/cont-disp.xhtml[^].

Basically, "inline" will cause the mail viewer to show your image in the body of the message view, and "attachment" will appear somewhere in the menu, letting the user to "download" it (but actually it will just extract the part's content and save it in a separate file).

If you really need a clickable reference in HTML, you need to add an HTML part and reference your image from there (this is usually done with "attachments", and, more often, not images). The tricky part is: how to reference this part in your href element? The answer is: there is a special URL scheme for this. This is explained in my past answers:
Sending HTML attachment with images[^],
how can i send image with text in email in asp[^],
How to attach a file in smtp mail implementation[^].

—SA
 
Share this answer
 
v2

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