Documentation
¶
Index ¶
- func Folders(acct EmailAccount) ([]string, error)
- func FormatDryRun(acct EmailAccount, opts SendOptions) string
- func SaveAttachments(acct EmailAccount, folder string, uid uint32, dir string) ([]string, error)
- func Send(acct EmailAccount, opts SendOptions) error
- func ValidateAccountName(name string) error
- type AttachmentInfo
- type Config
- type EmailAccount
- type Envelope
- type ListOptions
- type Message
- type SendOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Folders ¶
func Folders(acct EmailAccount) ([]string, error)
Folders returns a sorted list of mailbox names available on the server.
func FormatDryRun ¶
func FormatDryRun(acct EmailAccount, opts SendOptions) string
FormatDryRun returns a human-readable representation of the email that would be sent, for use with --dry-run.
func SaveAttachments ¶
SaveAttachments downloads and saves all attachments of a message to dir. It returns the list of file paths written.
func Send ¶
func Send(acct EmailAccount, opts SendOptions) error
Send composes and sends an email via SMTP using the provided account configuration.
func ValidateAccountName ¶
Types ¶
type AttachmentInfo ¶
type AttachmentInfo struct {
Filename string `json:"filename"`
Size int64 `json:"size"`
MIMEType string `json:"mime_type"`
}
AttachmentInfo holds metadata about a message attachment (no content).
type Config ¶
type Config struct {
Default string `json:"default"`
Accounts map[string]EmailAccount `json:"accounts"`
}
func LoadFromEnv ¶
func (*Config) AccountNames ¶
func (*Config) SetDefault ¶
func (*Config) Upsert ¶
func (c *Config) Upsert(name string, partial EmailAccount)
type EmailAccount ¶
type EmailAccount struct {
IMAPHost string `json:"imap_host,omitempty"`
IMAPPort int `json:"imap_port,omitempty"`
IMAPTLS string `json:"imap_tls,omitempty"`
SMTPHost string `json:"smtp_host,omitempty"`
SMTPPort int `json:"smtp_port,omitempty"`
SMTPTLS string `json:"smtp_tls,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
From string `json:"from,omitempty"`
}
type Envelope ¶
type Envelope struct {
UID uint32 `json:"uid"`
From string `json:"from"`
To []string `json:"to"`
Subject string `json:"subject"`
Date time.Time `json:"date"`
Flags []string `json:"flags"`
HasAttachments bool `json:"has_attachments"`
Size int64 `json:"size"`
}
Envelope holds metadata about an email message.
func List ¶
func List(acct EmailAccount, opts ListOptions) ([]Envelope, error)
List returns envelope metadata for messages in the given folder, filtered by opts.
type ListOptions ¶
type ListOptions struct {
Folder string
Limit int
Unread bool
From string
Subject string
Since *time.Time
Before *time.Time
}
ListOptions controls which messages are returned by List.
Click to show internal directories.
Click to hide internal directories.