package main import ( "log" "mime" "github.com/emersion/go-imap/v2/imapclient" "github.com/emersion/go-message/charset" ) type MailBox struct { Server string Client *imapclient.Client } func (mb *MailBox) ListMessages() (string, error) { return "", nil } func (mb *MailBox) Connect() error { options := &imapclient.Options{ WordDecoder: &mime.WordDecoder{CharsetReader: charset.Reader}, } var err error mb.Client, err = imapclient.DialStartTLS(mb.Server, options) if err != nil { log.Println("Error connnecting to", mb.Server, ":", err) return err } return nil }