emailsorter

package module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2022 License: MIT Imports: 12 Imported by: 0

README

emailsorter

A simple command line email client with limited features to manage your email.

Email credentials and imap configuration must be stored in a config file with a default name called email_config.json. (The name can be overridden with --config flag)

The config file format


{
        "email":"{{email_address}}",
        "password":"{{password}}",
        "imap_host":"{{imap_host}}",
        "imap_port":{{ imap_port }}



}

Usage

Usage: emailsorter

Usage: emailsorter <command>

Flags:

  --before         before (default: <none>)
  --body           email body filter (default: <none>)
  --config         email config file name (including full path) (default: email_config.json)
  --destdirectory  directory for the downloaded attachments (default: output)
  --destfolder     destination folder (default: <none>)
  --from           from address filter (default: <none>)
  --since          since (default: <none>)
  --srcfolder      source folder (default: INBOX)
  --subject        subject filter (default: <none>)

Commands:

  copy                           copy emails to the destfolder
  delete                         delete emails in the source folder meeting search criteria
  show                           print the subjects to the console
  list_and_download_attachments  list attachment names and download them in the destination directory for the mails in the source folder meeting search criteria
  version                        Show the version information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAttachmentNamesAndDownload added in v0.1.3

func GetAttachmentNamesAndDownload(imapclient *client.Client, uids []uint32, destDir string) ([]string, error)

func GetEmailUIDs

func GetEmailUIDs(imapclient *client.Client, params CmdParams) ([]uint32, error)

func NewImapClient

func NewImapClient(imapconfig ImapConfig) (*client.Client, error)

Types

type AttachmentsCommand added in v0.1.3

type AttachmentsCommand struct {
	Params     *CmdParams
	Imapconfig *ImapConfig
}

func (*AttachmentsCommand) Args added in v0.1.3

func (cmd *AttachmentsCommand) Args() string

func (*AttachmentsCommand) Hidden added in v0.1.3

func (cmd *AttachmentsCommand) Hidden() bool

func (*AttachmentsCommand) LongHelp added in v0.1.3

func (cmd *AttachmentsCommand) LongHelp() string

func (*AttachmentsCommand) Name added in v0.1.3

func (cmd *AttachmentsCommand) Name() string

func (*AttachmentsCommand) Register added in v0.1.3

func (cmd *AttachmentsCommand) Register(fs *flag.FlagSet)

func (*AttachmentsCommand) Run added in v0.1.3

func (cmd *AttachmentsCommand) Run(ctx context.Context, args []string) error

func (*AttachmentsCommand) ShortHelp added in v0.1.3

func (cmd *AttachmentsCommand) ShortHelp() string

type CmdParams

type CmdParams struct {
	From          string
	Subject       string
	Body          string
	Since         string
	SrcFolder     string
	DestFolder    string
	ConfigFile    string
	DestDirectory string
	Before        string
}

type CopyCommand

type CopyCommand struct {
	Params     *CmdParams
	Imapconfig *ImapConfig
}

func (*CopyCommand) Args

func (cmd *CopyCommand) Args() string

func (*CopyCommand) Hidden

func (cmd *CopyCommand) Hidden() bool

func (*CopyCommand) LongHelp

func (cmd *CopyCommand) LongHelp() string

func (*CopyCommand) Name

func (cmd *CopyCommand) Name() string

func (*CopyCommand) Register

func (cmd *CopyCommand) Register(fs *flag.FlagSet)

func (*CopyCommand) Run

func (cmd *CopyCommand) Run(ctx context.Context, args []string) error

func (*CopyCommand) ShortHelp

func (cmd *CopyCommand) ShortHelp() string

type DeleteCommand

type DeleteCommand struct {
	Params     *CmdParams
	Imapconfig *ImapConfig
}

func (*DeleteCommand) Args

func (cmd *DeleteCommand) Args() string

func (*DeleteCommand) Hidden

func (cmd *DeleteCommand) Hidden() bool

func (*DeleteCommand) LongHelp

func (cmd *DeleteCommand) LongHelp() string

func (*DeleteCommand) Name

func (cmd *DeleteCommand) Name() string

func (*DeleteCommand) Register

func (cmd *DeleteCommand) Register(fs *flag.FlagSet)

func (*DeleteCommand) Run

func (cmd *DeleteCommand) Run(ctx context.Context, args []string) error

func (*DeleteCommand) ShortHelp

func (cmd *DeleteCommand) ShortHelp() string

type ImapConfig

type ImapConfig struct {
	ImapHost string `json:"imap_host"`
	Email    string `json:"email"`
	Password string `json:"password"`
	ImapPort int    `json:"imap_port"`
}

func ReadConfig

func ReadConfig(filename string) (ImapConfig, error)

type MsgHeader

type MsgHeader struct {
	Subject  string
	SentDate time.Time
	Sender   string
}

func GetMessageHeaders

func GetMessageHeaders(imapclient *client.Client, uids []uint32) ([]MsgHeader, error)

type ShowCommand

type ShowCommand struct {
	Params     *CmdParams
	Imapconfig *ImapConfig
}

func (*ShowCommand) Args

func (cmd *ShowCommand) Args() string

func (*ShowCommand) Hidden

func (cmd *ShowCommand) Hidden() bool

func (*ShowCommand) LongHelp

func (cmd *ShowCommand) LongHelp() string

func (*ShowCommand) Name

func (cmd *ShowCommand) Name() string

func (*ShowCommand) Register

func (cmd *ShowCommand) Register(fs *flag.FlagSet)

func (*ShowCommand) Run

func (cmd *ShowCommand) Run(ctx context.Context, args []string) error

func (*ShowCommand) ShortHelp

func (cmd *ShowCommand) ShortHelp() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL