gpt4 book ai didi

ios - 无法检索额外的 header - Mailcore

转载 作者:行者123 更新时间:2023-12-01 22:18:02 24 4
gpt4 key购买 nike

对于某些电子邮件,我想发送带有标题的额外数据。就像我想知道电子​​邮件是否已加密。为此,我设置了额外的标题,如下所示。

设置额外的标题

let mailBuilder: MCOMessageBuilder! =  MCOMessageBuilder()
mailBuilder.header.subject = "Subject"
mailBuilder.header.setExtraHeaderValue("yes", forName: "Encrypted")
// set rest of data. From,TO,CC,Body etc and send email.. // Email sending is working properly.

检索额外的 header
func fetchRequestKind () -> MCOIMAPMessagesRequestKind {
let kind = MCOIMAPMessagesRequestKind()
let headers = kind.union(MCOIMAPMessagesRequestKind.headers)
let structure = headers.union(MCOIMAPMessagesRequestKind.structure)
let request = structure.union(MCOIMAPMessagesRequestKind.flags)
let requestHeader = request.union(MCOIMAPMessagesRequestKind.extraHeaders)
return requestHeader
}

let request = self.fetchRequestKind()

let messagesNumbers = MCOIndexSet.init() // range get set here
let fetch : MCOIMAPFetchMessagesOperation = self.imapSession.fetchMessagesByNumberOperation(withFolder: "Inbox", requestKind:request, numbers: messagesNumbers)
fetch.start({ (error, fetchedMessages, vanishedMessages) in
if(error != nil)
{
failure(error.debugDescription)
} else {
if let mails = fetchedMessages as? [MCOIMAPMessage] {
print("\(mails[0].header.subject) &&& \(mails[0].header.allExtraHeadersNames())")
}
})

但我没有以这种方式获得额外的标题..
我在这里做错了什么。?任何帮助,将不胜感激。

最佳答案

在开始之前,您必须在 fetch 操作中指定所需的额外 header 。在你的情况下:

fetch.extraHeaders = ["Encrypted"]

然后您可以使用以下方法检索该值:
mails[0].header.extraHeaderValue(forName: "Encrypted")

引用: https://github.com/MailCore/mailcore2/issues/1288

关于ios - 无法检索额外的 header - Mailcore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50922789/

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