我正在构建一个接收电子邮件的应用 我拿到了电子邮件的主题,但我无法获得正文电子邮件。 这是我的代码
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
所以请指导我这个
答案 0 :(得分:1)
试试这段代码它会对你有所帮助:
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;