如何在电子邮件中放置位图 [英] how to put a bitmap in an email

查看:243
本文介绍了如何在电子邮件中放置位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨在一起:-)



i有一个可以发送电子邮件的申请......



现在我想把一个位图文件放在一封电子邮件中(在文本中,而不是在附件中)。



问题:我不知道如何实现这个目的.. (我正在使用mfc,c ++,visual studio 10)



我不知道的例如:



- 如何将位图存储在电子邮件中?

- 我是否必须以某种方式转换它?



i听说过一些关于base64,这与我的问题有关吗?



有谁知道怎么做?



thx求助: - )

解决方案

您无需添加HTML。只有在想要可点击的引用时才需要HTML。在其他情况下,您只需添加具有不同内容类型的邮件部分。请参阅:

http://en.wikipedia.org/wiki/Content_type [< a href =http://en.wikipedia.org/wiki/Content_typetarget =_ blanktitle =New Window> ^ ]。



此处支持标准化的类型列表: http://www.iana.org/ assignments / media-types / media-types.xhtml [ ^ ]。



您需要以下类型: http://www.iana.org/assignments/media-types/media-types.xhtml#image [ ^ ]。



现在,您需要设置正确的内容处置 http://www.iana.org/assignments/cont-disp/cont-disp.xhtml [ ^ ]。



基本上,内联会导致邮件查看器在消息视图的正文中显示您的图像,并且附件将出现在菜单的某处,让用户下载它(但实际上它只是提取部件的内容并将其保存在单独的文件中) 。



如果你真的需要HTML中的可点击引用,你需要添加一个HTML部分并从那里引用你的图像(这通常用附件来完成,而且,更常见的是,不是图像)。棘手的部分是:如何在 href 元素中引用此部分?答案是:有一个特殊的 URL方案。我在过去的答案中对此进行了解释:

发送HTML图像附件 [ ^ ],

我怎样才能在asp的电子邮件中发送带有文本的图像 [ ^ ],

如何在smtp邮件实现中附加文件 [ ^ ]。



-SA

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:-)

解决方案

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


这篇关于如何在电子邮件中放置位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆