gpt4 book ai didi

swift - 在Swift 3中使用Gmail URL方案时具有HTML正文

转载 作者:行者123 更新时间:2023-12-03 09:19:57 24 4
gpt4 key购买 nike

我希望使用预先配置的主题来调用Gmail应用,并且该主体使用以下内容包含HTML:

let gmail = URL(string:"googlegmail:///co?subject=Subject&body=<body><H1>testing</H1></body>")
UIApplication.shared.openURL(gmail!)

这会使应用程序崩溃,然后我求助于:
var messageEncoded1 = "<body><H1>testing</H1></body>".addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed)
let gmail = URL(string:"googlegmail:///co?subject=Subject&body="+messageEncoded1!")
UIApplication.shared.openURL(gmail!)

这将创建一个URL并打开Gmail,但是,电子邮件正文显示为: <body><H1>testing</H1></body>而不是工作的 testing,如下所示:

测试

因此,问题是,是否有一种方法可以指定正文包含HTML,以便Gmail可以将其呈现为HTML?

最佳答案

不,目前,Gmail尚未将其呈现为HTML。此外,mailto标准RFC2368本身没有义务在body属性中呈现标签:

The special hname "body" indicates that the associated hvalue is thebody of the message. The "body" hname should contain the content forthe first text/plain body part of the message. The mailto URL isprimarily intended for generation of short text messages that areactually the content of automatic processing (such as "subscribe"messages for mailing lists), not general MIME bodies.

关于swift - 在Swift 3中使用Gmail URL方案时具有HTML正文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45000702/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com