Documentation
¶
Index ¶
- type CalendarAttendee
- type CalendarInvite
- type CalendarPerson
- type EmailAddress
- type EmailPart
- type EventStorer
- type Link
- type MessageFilter
- type Module
- func (m *Module) Name() string
- func (m *Module) OnEventStored(ev event.Event)
- func (m *Module) OnEventsDeleted(uuids []string)
- func (m *Module) PreviewMapper() event.PreviewMapper
- func (m *Module) RegisterProtectedRoutes(mux *http.ServeMux, protect func(http.Handler) http.Handler)
- func (m *Module) RegisterRoutes(_ *http.ServeMux, store event.Store)
- func (m *Module) SetEventService(es EventStorer)
- func (m *Module) SetRelay(cfg RelayConfig)
- func (m *Module) TCPServers() []tcp.ServerConfig
- func (m *Module) Type() string
- type ParsedEmail
- type RelayConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CalendarAttendee ¶ added in v2.14.0
type CalendarAttendee struct {
CalendarPerson
Status string `json:"status,omitempty"` // PARTSTAT: NEEDS-ACTION, ACCEPTED, DECLINED, TENTATIVE
Role string `json:"role,omitempty"` // REQ-PARTICIPANT, OPT-PARTICIPANT, CHAIR
}
CalendarAttendee is an invited person with their answer.
type CalendarInvite ¶ added in v2.14.0
type CalendarInvite struct {
Method string `json:"method,omitempty"` // REQUEST, CANCEL, REPLY…
Summary string `json:"summary"`
Start string `json:"start,omitempty"`
End string `json:"end,omitempty"`
TZ string `json:"tz,omitempty"`
AllDay bool `json:"all_day,omitempty"`
Location string `json:"location,omitempty"`
Description string `json:"description,omitempty"`
URL string `json:"url,omitempty"`
Status string `json:"status,omitempty"` // CONFIRMED, TENTATIVE, CANCELLED
UID string `json:"uid,omitempty"`
Sequence string `json:"sequence,omitempty"`
Recurrence string `json:"rrule,omitempty"`
Organizer *CalendarPerson `json:"organizer,omitempty"`
Attendees []CalendarAttendee `json:"attendees,omitempty"`
}
CalendarInvite is the first event of an iCalendar part or .ics attachment, enough for an invite card. Times are RFC 3339 when the time zone is known (UTC or a TZID this server knows); otherwise local "2006-01-02T15:04:05" with TZ naming the zone, or a date for all-day events.
type CalendarPerson ¶ added in v2.14.0
type CalendarPerson struct {
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
}
CalendarPerson is an organizer: name and email.
type EmailAddress ¶
EmailAddress represents an email address.
type EmailPart ¶ added in v2.14.0
type EmailPart struct {
Type string `json:"type"` // media type, e.g. text/watch-html
Label string `json:"label"` // short name for a tab: "Apple Watch", "AMP"…
Content string `json:"content"`
Size int `json:"size"` // bytes before truncation
Truncated bool `json:"truncated,omitempty"` // Content cut at 1 MB
}
EmailPart is a body part other than the text/plain and text/html bodies: the Apple Watch version, an AMP version, a calendar invite, a delivery report. Before parts existed these were dropped.
type EventStorer ¶
type Link ¶
type Link struct {
URL string `json:"url"`
Text string `json:"text,omitempty"`
Source string `json:"source"` // "html" or "text"
}
Link represents a URL extracted from a message.
type MessageFilter ¶
type MessageFilter struct {
To string
From string
Cc string
Subject string
SubjectContains string
SubjectRegex string
BodyContains string
Project string
Since float64 // unix timestamp (seconds)
Until float64 // unix timestamp (seconds)
Limit int
Offset int
Order string // "asc" or "desc"
}
MessageFilter holds filter criteria for SMTP message queries.
type Module ¶
type Module struct {
module.BaseModule
// contains filtered or unexported fields
}
func (*Module) OnEventStored ¶
OnEventStored notifies any long-poll waiters when a new SMTP event arrives.
func (*Module) OnEventsDeleted ¶
OnEventsDeleted removes the attachment rows of deleted events.
func (*Module) PreviewMapper ¶
func (m *Module) PreviewMapper() event.PreviewMapper
func (*Module) RegisterProtectedRoutes ¶
func (m *Module) RegisterProtectedRoutes(mux *http.ServeMux, protect func(http.Handler) http.Handler)
RegisterProtectedRoutes adds the SMTP testing API behind the API auth.
func (*Module) RegisterRoutes ¶
RegisterRoutes keeps the store for the SMTP testing API; the routes themselves go behind the API auth in RegisterProtectedRoutes.
func (*Module) SetEventService ¶
func (m *Module) SetEventService(es EventStorer)
func (*Module) SetRelay ¶ added in v2.13.0
func (m *Module) SetRelay(cfg RelayConfig)
SetRelay sets the outgoing SMTP server caught messages can be released to. Without it release is off.
func (*Module) TCPServers ¶
func (m *Module) TCPServers() []tcp.ServerConfig
type ParsedEmail ¶
type ParsedEmail struct {
ID *string `json:"id"`
Subject string `json:"subject"`
From []EmailAddress `json:"from"`
To []EmailAddress `json:"to"`
Cc []EmailAddress `json:"cc"`
Bcc []string `json:"bcc"`
ReplyTo []EmailAddress `json:"reply_to"`
Text string `json:"text"`
HTML string `json:"html"`
Raw string `json:"raw"`
// Parts are the other body parts (Apple Watch, AMP, calendar, delivery
// reports…), in message order; omitted when there are none.
Parts []EmailPart `json:"parts,omitempty"`
// Calendar is the invite from a text/calendar part or an .ics
// attachment; omitted when there is none.
Calendar *CalendarInvite `json:"calendar,omitempty"`
}
ParsedEmail is the structure stored as event payload. Field names match the original PHP Buggregator Message::jsonSerialize().
type RelayConfig ¶ added in v2.13.0
type RelayConfig struct {
Host string
Port int // default: 587 for starttls, 465 for tls, 25 for none
TLS string // "starttls" (default), "tls" (implicit, port 465) or "none"
Username string // empty: no AUTH
Password string
From string // MAIL FROM; empty: Username when it is an address, else the message's From
AllowedRecipients []string // address patterns like "*@example.com"; empty: any
InsecureSkipVerify bool // accept any TLS certificate (a local test relay)
// AuthOn is the server's API auth, not a relay setting: without it a
// release is taken only from this machine.
AuthOn bool
}
RelayConfig is the outgoing SMTP server a caught message can be released to. Off while Host is empty. Password never leaves the server.
func (RelayConfig) Enabled ¶ added in v2.13.0
func (c RelayConfig) Enabled() bool
Enabled reports whether a relay is configured.