(Swift) POP3 Fetch a Single Email by UIDL
Demonstrates how to fetch a single email by UIDL.
func chilkatTest() {
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let mailman = CkoMailMan()!
mailman.mailHost = "pop.example.com"
mailman.popUsername = "myLogin"
mailman.popPassword = "myPassword"
mailman.mailPort = 995
mailman.popSsl = true
var sa: CkoStringArray? = mailman.getUidls()
if mailman.lastMethodSuccess == false {
print("\(mailman.lastErrorText!)")
return
}
// Download each email by UIDL.
var uidl: String?
var i: Int = 0
var numUidls: Int = sa!.count.intValue
while i < numUidls {
uidl = sa!.getString(i)
print("\(uidl!)")
var email: CkoEmail? = mailman.fetchEmail(uidl)
if mailman.lastMethodSuccess == false {
print("\(mailman.lastErrorText!)")
return
}
print("\(email!.subject!)")
print("")
email = nil
i = i + 1
}
sa = nil
}
|