33 lines
746 B
Go
33 lines
746 B
Go
|
// Example program for the unreadMail library
|
||
|
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"flag"
|
||
|
"fmt"
|
||
|
"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")
|
||
|
passwdPtr := flag.String("passwd", "", "password for user")
|
||
|
|
||
|
flag.Parse()
|
||
|
par := &unreadMail.Parameters{*serverPtr, *portPtr, *certPtr, *userPtr, *passwdPtr}
|
||
|
|
||
|
mails, errs := unreadMail.FetchPlaintext(par)
|
||
|
if len(errs) > 0 {
|
||
|
for _, err := range errs {
|
||
|
fmt.Fprintln(os.Stderr, err)
|
||
|
}
|
||
|
}
|
||
|
for _, mail := range mails {
|
||
|
fmt.Println(mail)
|
||
|
fmt.Println("\n=*=*=*=*=*=*=*=*=\n")
|
||
|
}
|
||
|
}
|