mailcomposer

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package mailcomposer opens the system's screen for writing an email, filled in, for them to check and send. Nothing is sent without them.

nimbus native plugin add mail-composer

status, err := mailcomposer.Compose(ctx, mailcomposer.Options{
	To: []string{"hello@example.com"}, Subject: "Order 1042", Body: "Hello",
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available(ctx context.Context) bool

Available reports whether this phone can write an email. On iOS that needs an account in the Mail app. Android only finds out when Compose runs.

Types

type File

type File struct {
	Name string `json:"name"` // its file name
	Type string `json:"type"` // a MIME type, such as "application/pdf"
	Data []byte `json:"data"` // its contents
}

File is an attachment, as bytes.

type Options

type Options struct {
	To      []string `json:"to,omitempty"`      // who it goes to
	CC      []string `json:"cc,omitempty"`      // who's copied
	BCC     []string `json:"bcc,omitempty"`     // who's copied, unseen
	Subject string   `json:"subject,omitempty"` // its subject
	Body    string   `json:"body,omitempty"`    // its text
	// HTML treats Body as HTML. It's iOS only: Android sends it as plain text.
	HTML  bool   `json:"html,omitempty"`
	Files []File `json:"files,omitempty"` // attachments
}

Options is what to fill in. They can change all of it.

type Status

type Status string

Status is what they did.

const (
	Sent      Status = "sent"      // it went to the outbox
	Saved     Status = "saved"     // kept as a draft
	Cancelled Status = "cancelled" // they backed out
	// Unknown is every answer on Android, which can't tell.
	Unknown Status = "unknown"
)

func Compose

func Compose(ctx context.Context, o Options) (Status, error)

Compose opens the screen and returns when it closes. With no mail app it fails with plugin.Unavailable.

Jump to

Keyboard shortcuts

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