mailkit

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 33 Imported by: 0

README

rubi-mailkit

The shared engine of the Rubi mail plugins: iCloud Mail and Gmail. Both sign in with an app password over IMAP and SMTP, and behave the same way:

  • read, search and draft freely (by default); never marks mail as read;
  • send only after the user's approval, optionally watching for replies;
  • watches: wake the agent for new mail from given senders or with given words;
  • a privacy filter (sign-in codes, password resets, chosen senders and words) the agent can't see past without the user's passkey or password;
  • folder access: all folders or only some, and whether the agent may ask for the others;
  • the formatted version on request (read with format: "html"): the links with their text and a copy of the email that loads nothing from the internet (no tracking images), for buttons like "Unsubscribe" that plain text loses; mailing lists also show the sender's own unsubscribe address (List-Unsubscribe);
  • attachments: the agent may open them freely, may ask (the user approves each), or can't open them at all and sees only how many there are; attachments of private mail always need approval. An opened attachment is a file in a private folder, deleted after 30 minutes;
  • several accounts: every tool takes an optional account (the address), the default one otherwise. Folder access is set per account; the privacy filter applies to all of them.

A plugin is a Provider and a one-line main:

func main() { mailkit.Main(provider) }

This module is a library; it isn't installed on its own. MIT licensed.

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

View Source
const PublisherKey = "MCowBQYDK2VwAyEAxeDfKAkO77JdARN7Y2jJT3tXw9mN+GqqH8R5mhcxt8c="

PublisherKey is the Rubi-Project plugin signing key (public half).

Variables

This section is empty.

Functions

func Main

func Main(p Provider)

Main runs the plugin for a provider.

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
	// 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"`
}

Settings are stored (encrypted) in the vault for each connected account.

Jump to

Keyboard shortcuts

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