Documentation ¶
Overview ¶
Package mail implements a GUI email client.
Index ¶
- Variables
- func FilenameBase32(s string) string
- func IMAPToMailAddresses(as []imap.Address) []*mail.Address
- type AddressTextField
- type App
- func (a *App) Auth() error
- func (a *App) CacheMessages() error
- func (a *App) CacheMessagesForAccount(email string) error
- func (a *App) CacheMessagesForMailbox(c *imapclient.Client, email string, mailbox string) error
- func (a *App) CacheUIDs(uids []imap.UID, c *imapclient.Client, email string, mailbox string, ...) error
- func (a *App) Compose()
- func (a *App) GetMail() error
- func (a *App) Init()
- func (a *App) MakeToolbar(p *tree.Plan)
- func (a *App) MoveMessage(mailbox string) error
- func (a *App) SendMessage() error
- func (a *App) SignIn() (string, error)
- func (a *App) UpdateMessageList()
- func (a *App) UpdateReadMessage() error
- type CacheData
- type ReadMessage
- type SendMessage
- type SettingsData
Constants ¶
This section is empty.
Variables ¶
var Settings = &SettingsData{ SettingsBase: core.SettingsBase{ Name: "Mail", File: filepath.Join(core.TheApp.DataDir(), "Cogent Mail", "settings.toml"), }, }
Settings is the currently active global Cogent Mail settings instance.
Functions ¶
func FilenameBase32 ¶
FilenameBase32 converts the given string to a filename-safe base32 version.
func IMAPToMailAddresses ¶
IMAPToMailAddresses converts the given [imap.Address]es to [mail.Address]es.
Types ¶
type AddressTextField ¶
AddressTextField represents a mail.Address with a core.TextField.
func NewAddressTextField ¶
func NewAddressTextField(parent ...tree.Node) *AddressTextField
NewAddressTextField returns a new AddressTextField with the given optional parent: AddressTextField represents a mail.Address with a core.TextField.
func (*AddressTextField) Init ¶ added in v0.1.0
func (at *AddressTextField) Init()
func (*AddressTextField) WidgetValue ¶ added in v0.1.0
func (at *AddressTextField) WidgetValue() any
type App ¶
type App struct { core.Frame // AuthToken contains the [oauth2.Token] for each account. AuthToken map[string]*oauth2.Token `set:"-"` // AuthClient contains the [sasl.Client] authentication for sending messages for each account. AuthClient map[string]sasl.Client `set:"-"` // IMAPCLient contains the imap clients for each account. IMAPClient map[string]*imapclient.Client `set:"-"` // ComposeMessage is the current message we are editing ComposeMessage *SendMessage `set:"-"` // Cache contains the cache data, keyed by account and then mailbox. Cache map[string]map[string][]*CacheData `set:"-"` // ReadMessage is the current message we are reading ReadMessage *CacheData `set:"-"` // The current email account CurrentEmail string `set:"-"` // The current mailbox CurrentMailbox string `set:"-"` }
App is an email client app.
func (*App) Auth ¶
Auth authorizes access to the user's mail and sets [App.AuthClient]. If the user does not already have a saved auth token, it calls [SignIn].
func (*App) CacheMessages ¶
CacheMessages caches all of the messages from the server that have not already been cached. It caches them in the app's data directory.
func (*App) CacheMessagesForAccount ¶
CacheMessages caches all of the messages from the server that have not already been cached for the given email account. It caches them in the app's data directory.
func (*App) CacheMessagesForMailbox ¶
CacheMessagesForMailbox caches all of the messages from the server that have not already been cached for the given email account and mailbox. It caches them in the app's data directory.
func (*App) CacheUIDs ¶
func (a *App) CacheUIDs(uids []imap.UID, c *imapclient.Client, email string, mailbox string, dir string, cached []*CacheData, cachedFile string) error
CacheUIDs caches the messages with the given UIDs in the context of the other given values, using an iterative batched approach that fetches the five next most recent messages at a time, allowing for concurrent mail modifiation operations and correct ordering.
func (*App) MakeToolbar ¶
func (*App) MoveMessage ¶
MoveMessage moves the current message to the given mailbox.
func (*App) SignIn ¶
SignIn displays a dialog for the user to sign in with the platform of their choice. It returns the user's email address.
func (*App) UpdateMessageList ¶
func (a *App) UpdateMessageList()
UpdateMessageList updates the message list from [App.Cache].
func (*App) UpdateReadMessage ¶
UpdateReadMessage updates the view of the message currently being read.
type CacheData ¶
type CacheData struct { imap.Envelope UID imap.UID Filename string }
CacheData contains the data stored for a cached message in the cached messages file. It contains basic information about the message so that it can be displayed in the mail list in the GUI.
func (*CacheData) ToMessage ¶
func (cd *CacheData) ToMessage() *ReadMessage
ToMessage converts the CacheData to a ReadMessage.
type ReadMessage ¶
type ReadMessage struct { From []*mail.Address `display:"inline"` To []*mail.Address `display:"inline"` Subject string Date time.Time }
ReadMessage represents the data necessary to display a message for the user to read.
type SendMessage ¶
type SendMessage struct { From []*mail.Address `display:"inline"` To []*mail.Address `display:"inline"` Subject string Body string `display:"-"` }
SendMessage represents the data necessary for the user to send a message.
type SettingsData ¶
type SettingsData struct { core.SettingsBase // Accounts are the email accounts the user is signed into. Accounts []string }
SettingsData is the data type for the global Cogent Mail settings.