first commit
This commit is contained in:
32
imap_handler.go
Normal file
32
imap_handler.go
Normal file
@@ -0,0 +1,32 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user