// Example program for the unreadMail library package main import ( "flag" "fmt" "git.gutmet.org/goutil" "git.gutmet.org/libUnreadMail" "os" ) func main() { serverPtr := flag.String("server", "", "server IP") portPtr := flag.Int("port", 993, "server port") certPtr := flag.String("cert", "", "PEM cert of server") userPtr := flag.String("user", "", "user login name") pwFilePtr := flag.String("pwfile", "", "password file for user") flag.Parse() passwd, err := goutil.ReadFile(*pwFilePtr) if err != nil { fmt.Fprintln(os.Stderr, err) } else { par := &unreadMail.Parameters{*serverPtr, *portPtr, *certPtr, *userPtr, passwd} mails, errs := unreadMail.FetchPlaintext(par) for _, err := range errs { fmt.Fprintln(os.Stderr, err) } for _, mail := range mails { fmt.Println(mail) fmt.Println("\n=*=*=*=*=*=*=*=*=\n") } } }