在 MFMailCompositeViewController 中对文本和附加图像进行排序?

发布于 2024-09-05 22:18:48 字数 536 浏览 8 评论 0原文

在我当前正在编写的应用程序中,我想用文本和图像的组合填充电子邮件的消息正文。我花了很长时间才发现,为了获得嵌入的图像,您必须在邮件正文中使用粗体标签(...呃,是的),否则图像只会显示为附件。但现在我遇到的问题是所有图像都转到正文的末尾,并且我无法以编程方式在任何附件之后或之间放置文本。

到目前为止,我已经尝试过:

  1. 使用 img 标签和 base64 字符串添加图像作为正文字符串的一部分。这本来可以工作,但大多数电子邮件客户端拒绝以这种方式嵌入的图像。

  2. 使用普通的 img 标签和对附加文件的引用,使用指定的文件名。根本不起作用。

  3. 正常附加图像,但也会将文本块附加到电子邮件中。文本的嵌入方式与图像不同。结果是接收端附加了 txt 文件。

苹果已经将他们的 MFMailComposieViewController 类限制到了荒谬的地步,但我知道必须有一种方法可以做到这一点,因为他们在每个电子邮件的末尾添加了愚蠢的“从我的*苹果设备名称发送*”消息邮件。

那么有人有什么想法吗?

In the app I'm currently writing I'd like to populate the message body of an e-mail with a combination of text and images. It took me forever to find out that in order to get an embedded image, you had to have bold tags in the message body (...uhhh, yeah), otherwise the image just shows up as an attachment. But now I have the problem that all of the images just go to the end of the body, and I can't programmatically put text after or in between any of the attachments.

So far I've tried:

  1. Adding images as part of the body string using img tags and a base64 string. This would have worked, but most e-mail clients reject images embedded in this manner.

  2. Using normal img tags with a references to the attached files, using the assigned filenames. Didn't work at all.

  3. Attaching images normally, but also attaching blocks of text to the e-mail. The text is not embedded in the same manner as the images. Turns out to be an attached txt file on the receiving end.

Apple has restricted their MFMailComposieViewController class to the point of ridiculousness, but I know there has to be a way to do this, because they add in their stupid "Sent from my *apple device name here*" message at the end of every e-mail.

So does anyone have any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋凉 2024-09-12 22:18:48

它获取您的 HTML 消息(body 标记之间的所有内容等)并将其粘贴在 div 中。然后使用带有“cid”URI 的 img 标签引用图像附件。之后,它在另一个 div 中添加签名。我认为没有办法解决这个问题;我尝试了一段时间。

我还没有尝试添加更多文本/html 附件;也许这会起作用...

It takes your HTML message (everything between body tags, or so) and sticks it in a div. Image attachments are then referenced using img tags with "cid" URIs. After that, it adds the signature in another div. I don't think there's a way around this; I tried for a while.

I haven't tried adding more text/html attachments; maybe that'll work...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文