0
我正在构建一个应用程序接收电子邮件 我提取了电子邮件的主题,但我无法获得正文电子邮件。 这里是我的代码如何使用邮件核心2获取电子邮件的正文IOS Swift
let imapsession = MCOIMAPSession()
imapsession.hostname = "xxxx"
imapsession.port = 993
imapsession.username = "xxxx"
imapsession.password = "xxxx"
imapsession.connectionType = MCOConnectionType.TLS
let requestKind : MCOIMAPMessagesRequestKind = MCOIMAPMessagesRequestKind.Headers
let folder : String = "INBOX"
let uids : MCOIndexSet = MCOIndexSet(range: MCORangeMake(1, UINT64_MAX))
let fetchOperation : MCOIMAPFetchMessagesOperation = imapsession.fetchMessagesOperationWithFolder(folder, requestKind: requestKind, uids: uids)
fetchOperation.start { (err, msg, vanished) -> Void in
let msgs = msg as! [MCOIMAPMessage]
print("error from server \(err)")
for i in 0..<msgs.count
{
// Here i want the body of all emails fetched...
if let m = msgs[i].header.subject
{
print("\(i). \(m)")
}
}
}
我看到这个答案很好,但我无法理解
Fetch an email body in mailcore2 OSX with swift
所以请指导我这个
什么是message.uid?我在哪里申报?我将如何指定uid?好心的帮助我多一点... 感谢预期。 –
message.uid是引用电子邮件的唯一编号,不会随着时间而改变 – 2016-04-15 10:07:56
如何将值分配给uid以指定我需要的电子邮件地址? –