Back to

package mail2most

Latest Go to latest
Published: Feb 18, 2020 | License: MIT | Module:


Package mail2most is an implementation for reading and filtering emails and pushing them to mattermost

It uses the IMAP protocol to connect to an email account and can filter via:

- Folder - Subject - From - To - Time range

and pushes the subject and body into mattermost



const (
	// ERROR .
	ERROR string = "error"
	// INFO .
	INFO string = "info"
	// DEBUG .
	DEBUG string = "debug"
	LOGSTDOUT string = "stdout"
	LOGFILE string = "logfile"
	LOGFORMATJSON string = "json"
	LOGFORMATTEXT string = "text"

type Attachment

type Attachment struct {
	Filename string
	Content  []byte

Attachment .

type Mail

type Mail struct {
	ID            uint32
	Subject, Body string
	From, To      []*imap.Address
	Date          time.Time
	Attachments   []Attachment

Mail contains mail information

type Mail2Most

type Mail2Most struct {
	Config config
	Logger *log.Logger

Mail2Most implements the basic interface

func New

func New(confPath string) (Mail2Most, error)

New creates a new Mail2Most object

func (Mail2Most) Debug

func (m Mail2Most) Debug(msg string, params map[string]interface{})

Debug logging

func (Mail2Most) Error

func (m Mail2Most) Error(msg string, params map[string]interface{})

Error logging

func (Mail2Most) GetMail

func (m Mail2Most) GetMail(profile int) ([]Mail, error)

GetMail returns emails filter by profile id

func (Mail2Most) Info

func (m Mail2Most) Info(msg string, params map[string]interface{})

Info logging

func (Mail2Most) ListFlags

func (m Mail2Most) ListFlags(profile int) ([]string, error)

ListFlags lists all flags for profile

func (Mail2Most) ListMailBoxes

func (m Mail2Most) ListMailBoxes(profile int) ([]string, error)

ListMailBoxes lists all available mailboxes

func (Mail2Most) PostMattermost

func (m Mail2Most) PostMattermost(profile int, mail Mail) error

PostMattermost posts a msg to mattermost

func (Mail2Most) Run

func (m Mail2Most) Run() error

Run starts mail2most

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier