package main import ( "log" "net/http" "net/url" "os" "strings" ) func slash(w http.ResponseWriter, r *http.Request) { } func main() { var mb MailBox url, err := url.Parse(os.Getenv("MAILBOX")) if err != nil { log.Fatal("Bad parameter MAILBOX:", os.Getenv("MAILBOX"), "(", err, ")") } mb.Server = url.Host mb.User = os.Getenv("IMAP_USER") mb.Password = os.Getenv("IMAP_PASSWORD") mb.InBox, _ = strings.CutPrefix(url.Path, "/") err = mb.Connect() if err != nil { log.Fatal(err) } msg, err := mb.ListMessages() if err != nil { log.Fatal(err) } log.Println(msg) mb.Close() return http.HandleFunc("/", slash) http.ListenAndServe("0.0.0.0:8080", nil) }