Documentation
¶
Overview ¶
Package mailkit is the shared engine of the Rubi mail plugins (iCloud Mail, Gmail, …): read, search and draft freely (by default), send only after the user's approval, get notified about replies and about new mail the agent watches for, keep private mail (sign-in codes and the like) away from the agent, and limit which folders it sees. A plugin is a Provider plus a one-line main:
func main() { mailkit.Main(provider) }
A plugin can have several connected accounts. Every tool takes an optional account (the address); without it the default account is used.
Index ¶
Constants ¶
const PublisherKey = "MCowBQYDK2VwAyEAxeDfKAkO77JdARN7Y2jJT3tXw9mN+GqqH8R5mhcxt8c="
PublisherKey is the Rubi-Project plugin signing key (public half).
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Provider ¶
type Provider struct {
ID string // plugin id, e.g. "gmail"
Name string // e.g. "Gmail"
Version string
MinRubi string
Description string
Needs string // what the user needs to connect, shown before setup
Source string // source repository URL
ToolPrefix string // tool names are <ToolPrefix>_search, …
AddressLabel string
AddressPlaceholder string
AddressHelp string
PasswordLabel string
PasswordHelp string
PasswordURL string // where the user creates the app password
PasswordLink string // label of the PasswordURL button
// CleanPassword normalizes what the user pasted (default: trim spaces at the ends).
CleanPassword func(string) string
IMAPAddr string // host:port, implicit TLS
SMTPAddr string // host:port, STARTTLS
Drafts string // folder names when the server doesn't mark them (special-use)
Sent string
// SavesSent is true when the server files mail sent over SMTP in Sent by itself (Gmail); otherwise
// the plugin appends a copy.
SavesSent bool
// Gmail is true for Gmail's servers: searches run with Gmail's own search (X-GM-RAW), and labels are
// managed as Gmail exposes them over IMAP (a label is a folder; a message can be in several).
Gmail bool
// CustomServers: the user enters the IMAP and SMTP servers (or a known service fills them in);
// IMAPAddr and SMTPAddr are then unused.
CustomServers bool
// AuthServIDs are the servers whose Authentication-Results are trusted (e.g. "google.com" covers
// mx.google.com); empty: the topmost such header.
AuthServIDs []string
// MailDomain is used in Message-IDs when the address has none.
MailDomain string
// AuthError is shown when the server rejects the login.
AuthError string
}
Provider describes one mail service that signs in with an app password over IMAP and SMTP.
type Settings ¶
type Settings struct {
Address string `json:"address"`
FromName string `json:"from_name,omitempty"`
IMAPAddr string `json:"imap_addr"`
SMTPAddr string `json:"smtp_addr"`
Drafts string `json:"drafts"`
Sent string `json:"sent"`
WatchIntervalSeconds int `json:"watch_interval_seconds"`
TrackDays int `json:"track_days"`
Username string `json:"username,omitempty"` // when the server's login isn't the address
}
Settings are stored (encrypted) in the vault for each connected account.