(Go) POP3 Fetch a Single Email by UIDL
Demonstrates how to fetch a single email by UIDL.
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
mailman := chilkat.NewMailMan()
mailman.SetMailHost("pop.example.com")
mailman.SetPopUsername("myLogin")
mailman.SetPopPassword("myPassword")
mailman.SetMailPort(995)
mailman.SetPopSsl(true)
sa := mailman.GetUidls()
if mailman.LastMethodSuccess() == false {
fmt.Println(mailman.LastErrorText())
mailman.DisposeMailMan()
return
}
// Download each email by UIDL.
var uidl *string = new(string)
i := 0
numUidls := sa.Count()
for i < numUidls {
uidl = sa.GetString(i)
fmt.Println(*uidl)
email := mailman.FetchEmail(*uidl)
if mailman.LastMethodSuccess() == false {
fmt.Println(mailman.LastErrorText())
mailman.DisposeMailMan()
return
}
fmt.Println(email.Subject())
fmt.Println("")
email.DisposeEmail()
i = i + 1
}
sa.DisposeStringArray()
mailman.DisposeMailMan()
|