29 lines
523 B
Go
Executable File
29 lines
523 B
Go
Executable File
package main
|
|
|
|
import (
|
|
"local/args"
|
|
"local/sandbox/contact/contact"
|
|
"log"
|
|
)
|
|
|
|
func main() {
|
|
emailer := contact.NewEmailer()
|
|
as := args.NewArgSet()
|
|
as.Append(args.STRING, "imap", "imap server:port", "imap.gmail.com:993")
|
|
as.Append(args.INT, "n", "limit (<1 for inf)", 10)
|
|
if err := as.Parse(); err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
emailer.IMAP = as.Get("imap").GetString()
|
|
emailer.Limit = as.Get("n").GetInt()
|
|
|
|
msgs, err := emailer.Read()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
for msg := range msgs {
|
|
log.Println(msg)
|
|
}
|
|
}
|