是否可以使用MFMailComposeViewController将内嵌图像嵌入HTML电子邮件中? [英] Is it possible to embed an inline image in HTML email using MFMailComposeViewController?

查看:92
本文介绍了是否可以使用MFMailComposeViewController将内嵌图像嵌入HTML电子邮件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在iPhone OS 3.0上通过MFMailComposeViewController发送的HTML电子邮件中嵌入对图像的引用?

Is it possible to embed a reference to an image in an HTML email sent via MFMailComposeViewController on iPhone OS 3.0?

(void)addAttachmentData:(NSData*)attachment mimeType:(NSString*)mimeType fileName:(NSString*)filename

似乎没有提供任何设置或读取附件的Content-ID标头的方法,但是有什么方法可以使这项工作呢?

doesn't seem to provide any way of either setting or reading the Content-ID header for an attachment, but is there some way to make this work?

我见过执行此操作的应用程序,但是它们可能正在使用SKPSMTPMessage ...

I have seen apps that do this, but they're probably using SKPSMTPMessage...

推荐答案

我相信您可以在电子邮件正文中使用HTML标记来实现所需的功能.这并不常见,但是img的src属性实际上可以设置为base-64编码的图像数据.例如,您可以说"<img src='data:image/gif;base64,R0lGODlhUAAPAKIA......'>"并内嵌图像数据.

I believe you can use an HTML tag in the email's body to achieve what you're looking for. It's not common, but the img's src attribute can actually be set to base-64 encoded image data. For instance, you can say "<img src='data:image/gif;base64,R0lGODlhUAAPAKIA......'>" and embed the image data inline.

这是一篇包含更多信息的文章:

Here's an article with more information: https://web.archive.org/web/20140819061025/http://www.sweeting.org/mark/blog/2005/07/12/base64-encoded-images-embedded-in-html

我知道这可以在Mobile Safari中使用,但我从未在Mail中使用过它.似乎可以正常工作-我确信他们也使用WebKit来呈现HTML电子邮件.

I know for a fact that this works in Mobile Safari, but I've never used it in Mail. It seems like it would work - I'm sure they use WebKit to render the HTML email messages as well.

祝你好运!

这篇关于是否可以使用MFMailComposeViewController将内嵌图像嵌入HTML电子邮件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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