问题描述
我正在使用具有替代 text/plain 版本的Gmail API从Android设备发送电子邮件.该电子邮件的结构如下:
I'm sending emails from Android devices using the Gmail API with an alternative text/plain version. The email is structured as follows:
multipart/mixed
multipart/alternative
text/plain
text/html
attachment
除 text/plain 部分外,其他所有内容都可以正常运行,而该部分已被从 text/html 部分提取的经过净化的版本取代.
Everything works great, except for the text/plain part, which is being replaced by a sanitized version extracted from the text/html part.
用简单的话:如果我检查已发送邮件"中的内容,则存在原始的纯文本版本.仅在到达收件人的电子邮件中被替换.
In simpler words: if I check the content in "Sent Mail", the original plain/text version is there. It is only replaced in the email that reaches the recipient.
我真的不介意对 text/html 版本进行清理,但是我需要保留原始的 text/plain 版本.
I don't really mind the text/html version getting sanitized, but I need to keep the original text/plain version.
有人知道我如何阻止Gmail执行此操作吗?
Does anyone have an idea of how I can keep Gmail from doing this?
推荐答案
尝试遵循答案.尝试切换消息的顺序,将HTML部分放在文本/纯文本部分之前.
Try to follow the answer here. Try to switch the order of the message, putting the HTML part first before the text/plain part.
用户应根据用户的环境和偏好选择最佳"类型,或为用户提供可用的替代方案.通常,选择最佳类型意味着只显示可以显示的LAST部分.
The user should either choose the "best" type based on the user's environment and preferences, or offer the user the available alternatives. In general, choosing the best type means displaying only the LAST part that can be displayed.
它基于答案中链接的文档.
这篇关于Gmail API使用自动生成的HTML替换了正文/纯文本替换的正文部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!