mail

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package mail implements JMAP Mail (RFC 8621), JMAP MDN (RFC 9007), and JMAP S/MIME Verification (RFC 9219).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register()

Register registers all mail capabilities and methods with the jmap package. Must be called before using mail types.

Types

type Capability

type Capability struct {
	// MaxMailboxesPerEmail is the maximum number of mailboxes an email
	// may belong to. Nil means no limit.
	MaxMailboxesPerEmail *uint64 `json:"maxMailboxesPerEmail,omitempty"`

	// MaxMailboxDepth is the maximum depth of the mailbox hierarchy.
	// Nil means no limit.
	MaxMailboxDepth *uint64 `json:"maxMailboxDepth,omitempty"`

	// MaxSizeMailboxName is the maximum length of a mailbox name in octets.
	MaxSizeMailboxName uint64 `json:"maxSizeMailboxName"`

	// MaxSizeAttachmentsPerEmail is the maximum total size of attachments
	// per email in octets.
	MaxSizeAttachmentsPerEmail uint64 `json:"maxSizeAttachmentsPerEmail"`

	// EmailQuerySortOptions lists the supported sort properties for
	// Email/query.
	EmailQuerySortOptions []string `json:"emailQuerySortOptions"`

	// MayCreateTopLevelMailbox indicates whether the user may create
	// a mailbox at the top level.
	MayCreateTopLevelMailbox bool `json:"mayCreateTopLevelMailbox"`
}

Capability represents the urn:ietf:params:jmap:mail capability (RFC 8621 Section 2).

func (*Capability) New

func (c *Capability) New() jmap.Capability

New implements jmap.Capability.

func (*Capability) URI

func (c *Capability) URI() jmap.URI

URI implements jmap.Capability.

type DeliveryStatus

type DeliveryStatus struct {
	// SMTPReply is the SMTP reply string.
	SMTPReply string `json:"smtpReply"`

	// Delivered is the delivery state: "queued", "yes", "no", or "unknown".
	Delivered string `json:"delivered"`

	// Displayed is the display state: "unknown" or "yes".
	Displayed string `json:"displayed"`
}

DeliveryStatus represents the delivery status for a recipient.

type Email

type Email struct {
	// ID is the server-assigned identifier for this email.
	ID jmap.ID `json:"id,omitempty"`

	// BlobID is the identifier for the raw RFC 5322 message blob.
	BlobID *jmap.ID `json:"blobId,omitempty"`

	// ThreadID is the ID of the thread this email belongs to.
	ThreadID *jmap.ID `json:"threadId,omitempty"`

	// MailboxIDs maps mailbox IDs to true for each mailbox containing
	// this email.
	MailboxIDs map[jmap.ID]bool `json:"mailboxIds,omitempty"`

	// Keywords maps keyword strings to true for each keyword set.
	Keywords map[string]bool `json:"keywords,omitempty"`

	// Size is the size of the raw RFC 5322 message in octets.
	Size uint64 `json:"size"`

	// ReceivedAt is the date the email was received (UTC, RFC 3339).
	ReceivedAt *string `json:"receivedAt,omitempty"`

	// MessageID is the value of the Message-ID header (RFC 5322).
	MessageID []string `json:"messageId,omitempty"`

	// InReplyTo is the value of the In-Reply-To header.
	InReplyTo []string `json:"inReplyTo,omitempty"`

	// References is the value of the References header.
	References []string `json:"references,omitempty"`

	// Sender is the parsed Sender header value.
	Sender []*EmailAddress `json:"sender,omitempty"`

	// From is the parsed From header value.
	From []*EmailAddress `json:"from,omitempty"`

	// To is the parsed To header value.
	To []*EmailAddress `json:"to,omitempty"`

	// CC is the parsed Cc header value.
	CC []*EmailAddress `json:"cc,omitempty"`

	// BCC is the parsed Bcc header value.
	BCC []*EmailAddress `json:"bcc,omitempty"`

	// ReplyTo is the parsed Reply-To header value.
	ReplyTo []*EmailAddress `json:"replyTo,omitempty"`

	// Subject is the value of the Subject header.
	Subject *string `json:"subject,omitempty"`

	// SentAt is the parsed Date header value (RFC 3339).
	SentAt *string `json:"sentAt,omitempty"`

	// HasAttachment indicates whether the email has attachments.
	HasAttachment bool `json:"hasAttachment,omitempty"`

	// Preview is a plain-text preview of the email body.
	Preview *string `json:"preview,omitempty"`

	// BodyStructure is the full MIME structure of the email.
	BodyStructure *EmailBodyPart `json:"bodyStructure,omitempty"`

	// BodyValues maps part IDs to body values when requested.
	BodyValues map[string]*EmailBodyValue `json:"bodyValues,omitempty"`

	// TextBody is the list of text body parts.
	TextBody []*EmailBodyPart `json:"textBody,omitempty"`

	// HTMLBody is the list of HTML body parts.
	HTMLBody []*EmailBodyPart `json:"htmlBody,omitempty"`

	// Attachments is the list of attachment body parts.
	Attachments []*EmailBodyPart `json:"attachments,omitempty"`

	// Headers is the list of parsed header fields.
	Headers []*EmailHeader `json:"headers,omitempty"`
}

Email represents a JMAP Email object (RFC 8621 Section 4).

type EmailAddress

type EmailAddress struct {
	// Name is the display name, if present.
	Name *string `json:"name,omitempty"`

	// Email is the email address.
	Email string `json:"email"`
}

EmailAddress represents a parsed email address.

type EmailBodyPart

type EmailBodyPart struct {
	// PartID is the identifier for this part.
	PartID *string `json:"partId,omitempty"`

	// BlobID is the blob identifier for this part's content.
	BlobID *jmap.ID `json:"blobId,omitempty"`

	// Size is the size of this part in octets.
	Size *uint64 `json:"size,omitempty"`

	// Headers is the list of header fields for this part.
	Headers []*EmailHeader `json:"headers,omitempty"`

	// Name is the filename, if present.
	Name *string `json:"name,omitempty"`

	// Type is the media type, e.g. "text/plain".
	Type *string `json:"type,omitempty"`

	// Charset is the character set, e.g. "utf-8".
	Charset *string `json:"charset,omitempty"`

	// Disposition is the content disposition, e.g. "attachment".
	Disposition *string `json:"disposition,omitempty"`

	// CID is the Content-ID header value.
	CID *string `json:"cid,omitempty"`

	// Language is the list of Content-Language values.
	Language []string `json:"language,omitempty"`

	// Location is the Content-Location header value.
	Location *string `json:"location,omitempty"`

	// SubParts is the list of sub-parts for multipart types.
	SubParts []*EmailBodyPart `json:"subParts,omitempty"`
}

EmailBodyPart represents a MIME body part of an email.

type EmailBodyValue

type EmailBodyValue struct {
	// Value is the decoded body part content.
	Value string `json:"value"`

	// IsEncodingProblem indicates an encoding issue during decoding.
	IsEncodingProblem bool `json:"isEncodingProblem,omitempty"`

	// IsTruncated indicates the value was truncated.
	IsTruncated bool `json:"isTruncated,omitempty"`
}

EmailBodyValue represents the content of a body part.

type EmailChanges

type EmailChanges struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// SinceState is the state string from a previous response.
	SinceState string `json:"sinceState"`

	// MaxChanges is the maximum number of changed IDs to return.
	MaxChanges *uint64 `json:"maxChanges,omitempty"`
}

EmailChanges is the Email/changes method (RFC 8621 Section 4.2).

func (*EmailChanges) Name

func (m *EmailChanges) Name() string

Name implements jmap.Method.

func (*EmailChanges) Requires

func (m *EmailChanges) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailChangesResponse

type EmailChangesResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldState is the state string supplied by the client.
	OldState string `json:"oldState"`

	// NewState is the current state string after the changes.
	NewState string `json:"newState"`

	// HasMoreChanges indicates if there are more changes to fetch.
	HasMoreChanges bool `json:"hasMoreChanges"`

	// Created contains IDs of emails created since the old state.
	Created []jmap.ID `json:"created"`

	// Updated contains IDs of emails updated since the old state.
	Updated []jmap.ID `json:"updated"`

	// Destroyed contains IDs of emails destroyed since the old state.
	Destroyed []jmap.ID `json:"destroyed"`
}

EmailChangesResponse is the response to Email/changes.

func (*EmailChangesResponse) Name

func (r *EmailChangesResponse) Name() string

Name implements jmap.MethodResponse.

type EmailCopy

type EmailCopy struct {
	// FromAccountID is the source account.
	FromAccountID jmap.ID `json:"fromAccountId"`

	// IfFromInState only copies if the source account state matches.
	IfFromInState *string `json:"ifFromInState,omitempty"`

	// AccountID is the destination account.
	AccountID jmap.ID `json:"accountId"`

	// IfInState only copies if the destination account state matches.
	IfInState *string `json:"ifInState,omitempty"`

	// Create maps creation IDs to Email objects describing the copy.
	Create map[jmap.ID]*Email `json:"create,omitempty"`

	// OnSuccessDestroyOriginal destroys the original after a successful copy.
	OnSuccessDestroyOriginal *bool `json:"onSuccessDestroyOriginal,omitempty"`

	// DestroyFromIfInState only destroys the original if the source state
	// matches.
	DestroyFromIfInState *string `json:"destroyFromIfInState,omitempty"`
}

EmailCopy is the Email/copy method (RFC 8621 Section 4.7).

func (*EmailCopy) Name

func (m *EmailCopy) Name() string

Name implements jmap.Method.

func (*EmailCopy) Requires

func (m *EmailCopy) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailCopyResponse

type EmailCopyResponse struct {
	// FromAccountID is the source account.
	FromAccountID jmap.ID `json:"fromAccountId"`

	// AccountID is the destination account.
	AccountID jmap.ID `json:"accountId"`

	// OldState is the state of the destination account before the copy.
	OldState string `json:"oldState"`

	// NewState is the state of the destination account after the copy.
	NewState string `json:"newState"`

	// Created maps creation IDs to created Email objects.
	Created map[jmap.ID]*Email `json:"created,omitempty"`

	// NotCreated maps creation IDs to errors.
	NotCreated map[jmap.ID]*jmap.SetError `json:"notCreated,omitempty"`
}

EmailCopyResponse is the response to Email/copy.

func (*EmailCopyResponse) Name

func (r *EmailCopyResponse) Name() string

Name implements jmap.MethodResponse.

type EmailFilter

type EmailFilter struct {
	// InMailbox filters by mailbox membership.
	InMailbox *jmap.ID `json:"inMailbox,omitempty"`

	// InMailboxOtherThan filters by NOT being in these mailboxes.
	InMailboxOtherThan []jmap.ID `json:"inMailboxOtherThan,omitempty"`

	// Before filters emails received before this date (RFC 3339).
	Before *string `json:"before,omitempty"`

	// After filters emails received after this date (RFC 3339).
	After *string `json:"after,omitempty"`

	// MinSize filters emails with size >= this value.
	MinSize *uint64 `json:"minSize,omitempty"`

	// MaxSize filters emails with size < this value.
	MaxSize *uint64 `json:"maxSize,omitempty"`

	// AllInThreadHaveKeyword filters by all emails in thread having keyword.
	AllInThreadHaveKeyword *string `json:"allInThreadHaveKeyword,omitempty"`

	// SomeInThreadHaveKeyword filters by some email in thread having keyword.
	SomeInThreadHaveKeyword *string `json:"someInThreadHaveKeyword,omitempty"`

	// NoneInThreadHaveKeyword filters by no email in thread having keyword.
	NoneInThreadHaveKeyword *string `json:"noneInThreadHaveKeyword,omitempty"`

	// HasKeyword filters by keyword presence.
	HasKeyword *string `json:"hasKeyword,omitempty"`

	// NotKeyword filters by keyword absence.
	NotKeyword *string `json:"notKeyword,omitempty"`

	// HasAttachment filters by attachment presence.
	HasAttachment *bool `json:"hasAttachment,omitempty"`

	// Text searches all text fields.
	Text *string `json:"text,omitempty"`

	// From searches the From header.
	From *string `json:"from,omitempty"`

	// To searches the To header.
	To *string `json:"to,omitempty"`

	// Cc searches the Cc header.
	Cc *string `json:"cc,omitempty"`

	// Bcc searches the Bcc header.
	Bcc *string `json:"bcc,omitempty"`

	// Subject searches the Subject header.
	Subject *string `json:"subject,omitempty"`

	// Body searches the body content.
	Body *string `json:"body,omitempty"`

	// Header matches a specific header. The first element is the name,
	// the optional second element is the value to match.
	Header []string `json:"header,omitempty"`
}

EmailFilter is a filter for Email/query (RFC 8621 Section 4.4).

type EmailGet

type EmailGet struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// IDs is the list of Email IDs to retrieve.
	IDs []jmap.ID `json:"ids,omitempty"`

	// Properties lists the properties to include.
	Properties []string `json:"properties,omitempty"`

	// FetchTextBodyValues fetches text body values.
	FetchTextBodyValues bool `json:"fetchTextBodyValues,omitempty"`

	// FetchHTMLBodyValues fetches HTML body values.
	FetchHTMLBodyValues bool `json:"fetchHTMLBodyValues,omitempty"`

	// FetchAllBodyValues fetches all body values.
	FetchAllBodyValues bool `json:"fetchAllBodyValues,omitempty"`

	// MaxBodyValueBytes limits body value sizes.
	MaxBodyValueBytes uint64 `json:"maxBodyValueBytes,omitempty"`

	// BodyProperties lists properties to include for body parts.
	BodyProperties []string `json:"bodyProperties,omitempty"`
}

EmailGet is the Email/get method (RFC 8621 Section 4.1).

func (*EmailGet) Name

func (m *EmailGet) Name() string

Name implements jmap.Method.

func (*EmailGet) Requires

func (m *EmailGet) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailGetResponse

type EmailGetResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// State is the current state string for this data type.
	State string `json:"state"`

	// List contains the requested Email objects.
	List []*Email `json:"list"`

	// NotFound contains IDs that were not found.
	NotFound []jmap.ID `json:"notFound"`
}

EmailGetResponse is the response to Email/get.

func (*EmailGetResponse) Name

func (r *EmailGetResponse) Name() string

Name implements jmap.MethodResponse.

type EmailHeader

type EmailHeader struct {
	// Name is the header field name.
	Name string `json:"name"`

	// Value is the header field value.
	Value string `json:"value"`
}

EmailHeader represents a parsed email header field.

type EmailImport

type EmailImport struct {
	// BlobID is the blob identifier of the RFC 5322 message to import.
	BlobID jmap.ID `json:"blobId"`

	// MailboxIDs maps mailbox IDs to true for the mailboxes to add the
	// email to.
	MailboxIDs map[jmap.ID]bool `json:"mailboxIds"`

	// Keywords maps keywords to true for keywords to set on the email.
	Keywords map[string]bool `json:"keywords,omitempty"`

	// ReceivedAt is the date to set as the received date (RFC 3339).
	ReceivedAt *string `json:"receivedAt,omitempty"`
}

EmailImport describes an email to import via Email/import.

type EmailImportRequest

type EmailImportRequest struct {
	// AccountID is the account to import into.
	AccountID jmap.ID `json:"accountId"`

	// IfInState only imports if the current state matches.
	IfInState *string `json:"ifInState,omitempty"`

	// Emails maps creation IDs to EmailImport objects.
	Emails map[jmap.ID]*EmailImport `json:"emails"`
}

EmailImportRequest is the Email/import method (RFC 8621 Section 4.8).

func (*EmailImportRequest) Name

func (m *EmailImportRequest) Name() string

Name implements jmap.Method.

func (*EmailImportRequest) Requires

func (m *EmailImportRequest) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailImportResponse

type EmailImportResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldState is the state before the import.
	OldState string `json:"oldState"`

	// NewState is the state after the import.
	NewState string `json:"newState"`

	// Created maps creation IDs to created Email objects.
	Created map[jmap.ID]*Email `json:"created,omitempty"`

	// NotCreated maps creation IDs to errors.
	NotCreated map[jmap.ID]*jmap.SetError `json:"notCreated,omitempty"`
}

EmailImportResponse is the response to Email/import.

func (*EmailImportResponse) Name

func (r *EmailImportResponse) Name() string

Name implements jmap.MethodResponse.

type EmailParse

type EmailParse struct {
	// AccountID is the account to use for parsing.
	AccountID jmap.ID `json:"accountId"`

	// BlobIDs is the list of blob IDs to parse as RFC 5322 messages.
	BlobIDs []jmap.ID `json:"blobIds"`

	// Properties lists the Email properties to return.
	Properties []string `json:"properties,omitempty"`

	// FetchTextBodyValues fetches text body values.
	FetchTextBodyValues bool `json:"fetchTextBodyValues,omitempty"`

	// FetchHTMLBodyValues fetches HTML body values.
	FetchHTMLBodyValues bool `json:"fetchHTMLBodyValues,omitempty"`

	// FetchAllBodyValues fetches all body values.
	FetchAllBodyValues bool `json:"fetchAllBodyValues,omitempty"`

	// MaxBodyValueBytes limits body value sizes.
	MaxBodyValueBytes uint64 `json:"maxBodyValueBytes,omitempty"`
}

EmailParse is the Email/parse method (RFC 8621 Section 4.9).

func (*EmailParse) Name

func (m *EmailParse) Name() string

Name implements jmap.Method.

func (*EmailParse) Requires

func (m *EmailParse) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailParseResponse

type EmailParseResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// Parsed maps blob IDs to parsed Email objects.
	Parsed map[jmap.ID]*Email `json:"parsed,omitempty"`

	// NotParsable contains blob IDs that could not be parsed.
	NotParsable []jmap.ID `json:"notParsable,omitempty"`

	// NotFound contains blob IDs that were not found.
	NotFound []jmap.ID `json:"notFound,omitempty"`
}

EmailParseResponse is the response to Email/parse.

func (*EmailParseResponse) Name

func (r *EmailParseResponse) Name() string

Name implements jmap.MethodResponse.

type EmailQuery

type EmailQuery struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// Filter specifies conditions for the query.
	Filter *EmailFilter `json:"filter,omitempty"`

	// Sort specifies the sort order for results.
	Sort []*EmailSort `json:"sort,omitempty"`

	// Position is the zero-based index of the first result to return.
	Position int64 `json:"position,omitempty"`

	// Anchor is the ID of an item to use as the position reference.
	Anchor *jmap.ID `json:"anchor,omitempty"`

	// AnchorOffset is the offset from the anchor to the first result.
	AnchorOffset int64 `json:"anchorOffset,omitempty"`

	// Limit is the maximum number of results to return.
	Limit *uint64 `json:"limit,omitempty"`

	// CalculateTotal requests the server include a total count.
	CalculateTotal bool `json:"calculateTotal,omitempty"`

	// CollapseThreads collapses results to one email per thread.
	CollapseThreads bool `json:"collapseThreads,omitempty"`
}

EmailQuery is the Email/query method (RFC 8621 Section 4.4).

func (*EmailQuery) Name

func (m *EmailQuery) Name() string

Name implements jmap.Method.

func (*EmailQuery) Requires

func (m *EmailQuery) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailQueryChanges

type EmailQueryChanges struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// Filter specifies conditions for the query.
	Filter *EmailFilter `json:"filter,omitempty"`

	// Sort specifies the sort order for results.
	Sort []*EmailSort `json:"sort,omitempty"`

	// SinceQueryState is the query state from a previous Email/query.
	SinceQueryState string `json:"sinceQueryState"`

	// MaxChanges is the maximum number of changes to return.
	MaxChanges *uint64 `json:"maxChanges,omitempty"`

	// UpToID limits changes to those up to and including this ID.
	UpToID *jmap.ID `json:"upToId,omitempty"`

	// CalculateTotal requests the server include a total count.
	CalculateTotal bool `json:"calculateTotal,omitempty"`

	// CollapseThreads collapses results to one email per thread.
	CollapseThreads bool `json:"collapseThreads,omitempty"`
}

EmailQueryChanges is the Email/queryChanges method (RFC 8621 Section 4.5).

func (*EmailQueryChanges) Name

func (m *EmailQueryChanges) Name() string

Name implements jmap.Method.

func (*EmailQueryChanges) Requires

func (m *EmailQueryChanges) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailQueryChangesResponse

type EmailQueryChangesResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldQueryState is the query state supplied by the client.
	OldQueryState string `json:"oldQueryState"`

	// NewQueryState is the current query state.
	NewQueryState string `json:"newQueryState"`

	// Removed contains IDs removed from the query results.
	Removed []jmap.ID `json:"removed"`

	// Added contains items added to the query results with their positions.
	Added []jmap.AddedItem `json:"added"`

	// Total is the total number of matching results, if requested.
	Total *uint64 `json:"total,omitempty"`
}

EmailQueryChangesResponse is the response to Email/queryChanges.

func (*EmailQueryChangesResponse) Name

Name implements jmap.MethodResponse.

type EmailQueryResponse

type EmailQueryResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// QueryState is the current state of the query.
	QueryState string `json:"queryState"`

	// CanCalculateChanges indicates if the server supports queryChanges.
	CanCalculateChanges bool `json:"canCalculateChanges"`

	// Position is the zero-based index of the first result returned.
	Position uint64 `json:"position"`

	// IDs contains the IDs of the matching Email objects.
	IDs []jmap.ID `json:"ids"`

	// Total is the total number of matching results, if requested.
	Total *uint64 `json:"total,omitempty"`

	// Limit is the limit that was applied to the query.
	Limit *uint64 `json:"limit,omitempty"`
}

EmailQueryResponse is the response to Email/query.

func (*EmailQueryResponse) Name

func (r *EmailQueryResponse) Name() string

Name implements jmap.MethodResponse.

type EmailSet

type EmailSet struct {
	// AccountID is the account to modify.
	AccountID jmap.ID `json:"accountId"`

	// IfInState only applies changes if the current state matches.
	IfInState *string `json:"ifInState,omitempty"`

	// Create maps creation IDs to Email objects to create.
	Create map[jmap.ID]*Email `json:"create,omitempty"`

	// Update maps Email IDs to patch objects.
	Update map[jmap.ID]*jmap.Patch `json:"update,omitempty"`

	// Destroy is a list of Email IDs to destroy.
	Destroy []jmap.ID `json:"destroy,omitempty"`
}

EmailSet is the Email/set method (RFC 8621 Section 4.3).

func (*EmailSet) Name

func (m *EmailSet) Name() string

Name implements jmap.Method.

func (*EmailSet) Requires

func (m *EmailSet) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailSetResponse

type EmailSetResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldState is the state before the changes.
	OldState string `json:"oldState"`

	// NewState is the state after the changes.
	NewState string `json:"newState"`

	// Created maps creation IDs to created Email objects.
	Created map[jmap.ID]*Email `json:"created,omitempty"`

	// Updated maps Email IDs to updated Email objects.
	Updated map[jmap.ID]*Email `json:"updated,omitempty"`

	// Destroyed contains IDs of destroyed Emails.
	Destroyed []jmap.ID `json:"destroyed,omitempty"`

	// NotCreated maps creation IDs to errors.
	NotCreated map[jmap.ID]*jmap.SetError `json:"notCreated,omitempty"`

	// NotUpdated maps Email IDs to errors.
	NotUpdated map[jmap.ID]*jmap.SetError `json:"notUpdated,omitempty"`

	// NotDestroyed maps Email IDs to errors.
	NotDestroyed map[jmap.ID]*jmap.SetError `json:"notDestroyed,omitempty"`
}

EmailSetResponse is the response to Email/set.

func (*EmailSetResponse) Name

func (r *EmailSetResponse) Name() string

Name implements jmap.MethodResponse.

type EmailSort

type EmailSort struct {
	// Property is the Email property to sort by.
	Property string `json:"property"`

	// IsAscending controls sort direction. Default is true.
	IsAscending *bool `json:"isAscending,omitempty"`

	// Collation is the collation algorithm to use for string sorts.
	Collation *string `json:"collation,omitempty"`
}

EmailSort defines the sort order for Email/query results.

type EmailSubmission

type EmailSubmission struct {
	// ID is the server-assigned identifier for this submission.
	ID jmap.ID `json:"id,omitempty"`

	// IdentityID is the ID of the Identity used for sending.
	IdentityID jmap.ID `json:"identityId"`

	// EmailID is the ID of the Email being submitted.
	EmailID jmap.ID `json:"emailId"`

	// ThreadID is the thread ID of the submitted email.
	ThreadID *jmap.ID `json:"threadId,omitempty"`

	// Envelope overrides the SMTP envelope.
	Envelope *Envelope `json:"envelope,omitempty"`

	// SendAt is the date to send the email (for delayed sending).
	SendAt *string `json:"sendAt,omitempty"`

	// UndoStatus is the undo status: "pending", "final", or "canceled".
	UndoStatus *string `json:"undoStatus,omitempty"`

	// DeliveryStatus maps recipient email addresses to delivery statuses.
	DeliveryStatus map[string]*DeliveryStatus `json:"deliveryStatus,omitempty"`

	// DSNBlobIDs is a list of blob IDs for delivery status notifications.
	DSNBlobIDs []jmap.ID `json:"dsnBlobIds,omitempty"`

	// MDNBlobIDs is a list of blob IDs for message disposition notifications.
	MDNBlobIDs []jmap.ID `json:"mdnBlobIds,omitempty"`
}

EmailSubmission represents a JMAP EmailSubmission object (RFC 8621 Section 7).

type EmailSubmissionChanges

type EmailSubmissionChanges struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// SinceState is the state string from a previous response.
	SinceState string `json:"sinceState"`

	// MaxChanges is the maximum number of changed IDs to return.
	MaxChanges *uint64 `json:"maxChanges,omitempty"`
}

EmailSubmissionChanges is the EmailSubmission/changes method (RFC 8621 Section 7.2).

func (*EmailSubmissionChanges) Name

func (m *EmailSubmissionChanges) Name() string

Name implements jmap.Method.

func (*EmailSubmissionChanges) Requires

func (m *EmailSubmissionChanges) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailSubmissionChangesResponse

type EmailSubmissionChangesResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldState is the state string supplied by the client.
	OldState string `json:"oldState"`

	// NewState is the current state string after the changes.
	NewState string `json:"newState"`

	// HasMoreChanges indicates if there are more changes to fetch.
	HasMoreChanges bool `json:"hasMoreChanges"`

	// Created contains IDs of submissions created since the old state.
	Created []jmap.ID `json:"created"`

	// Updated contains IDs of submissions updated since the old state.
	Updated []jmap.ID `json:"updated"`

	// Destroyed contains IDs of submissions destroyed since the old state.
	Destroyed []jmap.ID `json:"destroyed"`
}

EmailSubmissionChangesResponse is the response to EmailSubmission/changes.

func (*EmailSubmissionChangesResponse) Name

Name implements jmap.MethodResponse.

type EmailSubmissionFilter

type EmailSubmissionFilter struct {
	// IdentityIDs filters by identity IDs.
	IdentityIDs []jmap.ID `json:"identityIds,omitempty"`

	// EmailIDs filters by email IDs.
	EmailIDs []jmap.ID `json:"emailIds,omitempty"`

	// ThreadIDs filters by thread IDs.
	ThreadIDs []jmap.ID `json:"threadIds,omitempty"`

	// UndoStatus filters by undo status.
	UndoStatus *string `json:"undoStatus,omitempty"`

	// Before filters submissions before this date (RFC 3339).
	Before *string `json:"before,omitempty"`

	// After filters submissions after this date (RFC 3339).
	After *string `json:"after,omitempty"`
}

EmailSubmissionFilter is a filter for EmailSubmission/query.

type EmailSubmissionGet

type EmailSubmissionGet struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// IDs is the list of EmailSubmission IDs to retrieve.
	IDs []jmap.ID `json:"ids,omitempty"`

	// Properties lists the properties to include.
	Properties []string `json:"properties,omitempty"`
}

EmailSubmissionGet is the EmailSubmission/get method (RFC 8621 Section 7.1).

func (*EmailSubmissionGet) Name

func (m *EmailSubmissionGet) Name() string

Name implements jmap.Method.

func (*EmailSubmissionGet) Requires

func (m *EmailSubmissionGet) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailSubmissionGetResponse

type EmailSubmissionGetResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// State is the current state string for this data type.
	State string `json:"state"`

	// List contains the requested EmailSubmission objects.
	List []*EmailSubmission `json:"list"`

	// NotFound contains IDs that were not found.
	NotFound []jmap.ID `json:"notFound"`
}

EmailSubmissionGetResponse is the response to EmailSubmission/get.

func (*EmailSubmissionGetResponse) Name

Name implements jmap.MethodResponse.

type EmailSubmissionQuery

type EmailSubmissionQuery struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// Filter specifies conditions for the query.
	Filter *EmailSubmissionFilter `json:"filter,omitempty"`

	// Sort specifies the sort order for results.
	Sort []*EmailSubmissionSort `json:"sort,omitempty"`

	// Position is the zero-based index of the first result to return.
	Position int64 `json:"position,omitempty"`

	// Anchor is the ID of an item to use as the position reference.
	Anchor *jmap.ID `json:"anchor,omitempty"`

	// AnchorOffset is the offset from the anchor to the first result.
	AnchorOffset int64 `json:"anchorOffset,omitempty"`

	// Limit is the maximum number of results to return.
	Limit *uint64 `json:"limit,omitempty"`

	// CalculateTotal requests the server include a total count.
	CalculateTotal bool `json:"calculateTotal,omitempty"`
}

EmailSubmissionQuery is the EmailSubmission/query method (RFC 8621 Section 7.4).

func (*EmailSubmissionQuery) Name

func (m *EmailSubmissionQuery) Name() string

Name implements jmap.Method.

func (*EmailSubmissionQuery) Requires

func (m *EmailSubmissionQuery) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailSubmissionQueryChanges

type EmailSubmissionQueryChanges struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// Filter specifies conditions for the query.
	Filter *EmailSubmissionFilter `json:"filter,omitempty"`

	// Sort specifies the sort order for results.
	Sort []*EmailSubmissionSort `json:"sort,omitempty"`

	// SinceQueryState is the query state from a previous query.
	SinceQueryState string `json:"sinceQueryState"`

	// MaxChanges is the maximum number of changes to return.
	MaxChanges *uint64 `json:"maxChanges,omitempty"`

	// UpToID limits changes to those up to and including this ID.
	UpToID *jmap.ID `json:"upToId,omitempty"`

	// CalculateTotal requests the server include a total count.
	CalculateTotal bool `json:"calculateTotal,omitempty"`
}

EmailSubmissionQueryChanges is the EmailSubmission/queryChanges method (RFC 8621 Section 7.5).

func (*EmailSubmissionQueryChanges) Name

Name implements jmap.Method.

func (*EmailSubmissionQueryChanges) Requires

func (m *EmailSubmissionQueryChanges) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailSubmissionQueryChangesResponse

type EmailSubmissionQueryChangesResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldQueryState is the query state supplied by the client.
	OldQueryState string `json:"oldQueryState"`

	// NewQueryState is the current query state.
	NewQueryState string `json:"newQueryState"`

	// Removed contains IDs removed from the query results.
	Removed []jmap.ID `json:"removed"`

	// Added contains items added to the query results with their positions.
	Added []jmap.AddedItem `json:"added"`

	// Total is the total number of matching results, if requested.
	Total *uint64 `json:"total,omitempty"`
}

EmailSubmissionQueryChangesResponse is the response to EmailSubmission/queryChanges.

func (*EmailSubmissionQueryChangesResponse) Name

Name implements jmap.MethodResponse.

type EmailSubmissionQueryResponse

type EmailSubmissionQueryResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// QueryState is the current state of the query.
	QueryState string `json:"queryState"`

	// CanCalculateChanges indicates if the server supports queryChanges.
	CanCalculateChanges bool `json:"canCalculateChanges"`

	// Position is the zero-based index of the first result returned.
	Position uint64 `json:"position"`

	// IDs contains the IDs of the matching EmailSubmission objects.
	IDs []jmap.ID `json:"ids"`

	// Total is the total number of matching results, if requested.
	Total *uint64 `json:"total,omitempty"`

	// Limit is the limit that was applied to the query.
	Limit *uint64 `json:"limit,omitempty"`
}

EmailSubmissionQueryResponse is the response to EmailSubmission/query.

func (*EmailSubmissionQueryResponse) Name

Name implements jmap.MethodResponse.

type EmailSubmissionSet

type EmailSubmissionSet struct {
	// AccountID is the account to modify.
	AccountID jmap.ID `json:"accountId"`

	// IfInState only applies changes if the current state matches.
	IfInState *string `json:"ifInState,omitempty"`

	// Create maps creation IDs to EmailSubmission objects to create.
	Create map[jmap.ID]*EmailSubmission `json:"create,omitempty"`

	// Update maps EmailSubmission IDs to patch objects.
	Update map[jmap.ID]*jmap.Patch `json:"update,omitempty"`

	// Destroy is a list of EmailSubmission IDs to destroy.
	Destroy []jmap.ID `json:"destroy,omitempty"`

	// OnSuccessUpdateEmail maps EmailSubmission creation/ID to Email
	// patch objects to apply on success.
	OnSuccessUpdateEmail map[jmap.ID]*jmap.Patch `json:"onSuccessUpdateEmail,omitempty"`

	// OnSuccessDestroyEmail is a list of Email IDs to destroy on
	// successful submission.
	OnSuccessDestroyEmail []jmap.ID `json:"onSuccessDestroyEmail,omitempty"`
}

EmailSubmissionSet is the EmailSubmission/set method (RFC 8621 Section 7.3).

func (*EmailSubmissionSet) Name

func (m *EmailSubmissionSet) Name() string

Name implements jmap.Method.

func (*EmailSubmissionSet) Requires

func (m *EmailSubmissionSet) Requires() []jmap.URI

Requires implements jmap.Method.

type EmailSubmissionSetResponse

type EmailSubmissionSetResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldState is the state before the changes.
	OldState string `json:"oldState"`

	// NewState is the state after the changes.
	NewState string `json:"newState"`

	// Created maps creation IDs to created EmailSubmission objects.
	Created map[jmap.ID]*EmailSubmission `json:"created,omitempty"`

	// Updated maps EmailSubmission IDs to updated EmailSubmission objects.
	Updated map[jmap.ID]*EmailSubmission `json:"updated,omitempty"`

	// Destroyed contains IDs of destroyed EmailSubmissions.
	Destroyed []jmap.ID `json:"destroyed,omitempty"`

	// NotCreated maps creation IDs to errors.
	NotCreated map[jmap.ID]*jmap.SetError `json:"notCreated,omitempty"`

	// NotUpdated maps EmailSubmission IDs to errors.
	NotUpdated map[jmap.ID]*jmap.SetError `json:"notUpdated,omitempty"`

	// NotDestroyed maps EmailSubmission IDs to errors.
	NotDestroyed map[jmap.ID]*jmap.SetError `json:"notDestroyed,omitempty"`
}

EmailSubmissionSetResponse is the response to EmailSubmission/set.

func (*EmailSubmissionSetResponse) Name

Name implements jmap.MethodResponse.

type EmailSubmissionSort

type EmailSubmissionSort struct {
	// Property is the EmailSubmission property to sort by.
	Property string `json:"property"`

	// IsAscending controls sort direction. Default is true.
	IsAscending *bool `json:"isAscending,omitempty"`
}

EmailSubmissionSort defines the sort order for EmailSubmission/query.

type Envelope

type Envelope struct {
	// MailFrom is the envelope sender address.
	MailFrom *EnvelopeAddress `json:"mailFrom"`

	// RcptTo is the list of envelope recipient addresses.
	RcptTo []*EnvelopeAddress `json:"rcptTo"`
}

Envelope represents the SMTP envelope for a submission.

type EnvelopeAddress

type EnvelopeAddress struct {
	// Email is the email address.
	Email string `json:"email"`

	// Parameters maps SMTP extension parameter names to values.
	Parameters map[string]*string `json:"parameters,omitempty"`
}

EnvelopeAddress represents an SMTP envelope address with parameters.

type Identity

type Identity struct {
	// ID is the server-assigned identifier for this identity.
	ID jmap.ID `json:"id,omitempty"`

	// Name is the display name for this identity.
	Name string `json:"name"`

	// Email is the email address for this identity.
	Email string `json:"email"`

	// ReplyTo is the default Reply-To addresses.
	ReplyTo []*EmailAddress `json:"replyTo,omitempty"`

	// BCC is the default BCC addresses.
	BCC []*EmailAddress `json:"bcc,omitempty"`

	// TextSignature is the default plain-text signature.
	TextSignature *string `json:"textSignature,omitempty"`

	// HTMLSignature is the default HTML signature.
	HTMLSignature *string `json:"htmlSignature,omitempty"`

	// MayDelete indicates whether this identity may be deleted.
	MayDelete bool `json:"mayDelete"`
}

Identity represents a JMAP Identity object (RFC 8621 Section 6).

type IdentityChanges

type IdentityChanges struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// SinceState is the state string from a previous response.
	SinceState string `json:"sinceState"`

	// MaxChanges is the maximum number of changed IDs to return.
	MaxChanges *uint64 `json:"maxChanges,omitempty"`
}

IdentityChanges is the Identity/changes method (RFC 8621 Section 6.2).

func (*IdentityChanges) Name

func (m *IdentityChanges) Name() string

Name implements jmap.Method.

func (*IdentityChanges) Requires

func (m *IdentityChanges) Requires() []jmap.URI

Requires implements jmap.Method.

type IdentityChangesResponse

type IdentityChangesResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldState is the state string supplied by the client.
	OldState string `json:"oldState"`

	// NewState is the current state string after the changes.
	NewState string `json:"newState"`

	// HasMoreChanges indicates if there are more changes to fetch.
	HasMoreChanges bool `json:"hasMoreChanges"`

	// Created contains IDs of identities created since the old state.
	Created []jmap.ID `json:"created"`

	// Updated contains IDs of identities updated since the old state.
	Updated []jmap.ID `json:"updated"`

	// Destroyed contains IDs of identities destroyed since the old state.
	Destroyed []jmap.ID `json:"destroyed"`
}

IdentityChangesResponse is the response to Identity/changes.

func (*IdentityChangesResponse) Name

func (r *IdentityChangesResponse) Name() string

Name implements jmap.MethodResponse.

type IdentityGet

type IdentityGet struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// IDs is the list of Identity IDs to retrieve.
	IDs []jmap.ID `json:"ids,omitempty"`

	// Properties lists the properties to include.
	Properties []string `json:"properties,omitempty"`
}

IdentityGet is the Identity/get method (RFC 8621 Section 6.1).

func (*IdentityGet) Name

func (m *IdentityGet) Name() string

Name implements jmap.Method.

func (*IdentityGet) Requires

func (m *IdentityGet) Requires() []jmap.URI

Requires implements jmap.Method.

type IdentityGetResponse

type IdentityGetResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// State is the current state string for this data type.
	State string `json:"state"`

	// List contains the requested Identity objects.
	List []*Identity `json:"list"`

	// NotFound contains IDs that were not found.
	NotFound []jmap.ID `json:"notFound"`
}

IdentityGetResponse is the response to Identity/get.

func (*IdentityGetResponse) Name

func (r *IdentityGetResponse) Name() string

Name implements jmap.MethodResponse.

type IdentitySet

type IdentitySet struct {
	// AccountID is the account to modify.
	AccountID jmap.ID `json:"accountId"`

	// IfInState only applies changes if the current state matches.
	IfInState *string `json:"ifInState,omitempty"`

	// Create maps creation IDs to Identity objects to create.
	Create map[jmap.ID]*Identity `json:"create,omitempty"`

	// Update maps Identity IDs to patch objects.
	Update map[jmap.ID]*jmap.Patch `json:"update,omitempty"`

	// Destroy is a list of Identity IDs to destroy.
	Destroy []jmap.ID `json:"destroy,omitempty"`
}

IdentitySet is the Identity/set method (RFC 8621 Section 6.3).

func (*IdentitySet) Name

func (m *IdentitySet) Name() string

Name implements jmap.Method.

func (*IdentitySet) Requires

func (m *IdentitySet) Requires() []jmap.URI

Requires implements jmap.Method.

type IdentitySetResponse

type IdentitySetResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldState is the state before the changes.
	OldState string `json:"oldState"`

	// NewState is the state after the changes.
	NewState string `json:"newState"`

	// Created maps creation IDs to created Identity objects.
	Created map[jmap.ID]*Identity `json:"created,omitempty"`

	// Updated maps Identity IDs to updated Identity objects.
	Updated map[jmap.ID]*Identity `json:"updated,omitempty"`

	// Destroyed contains IDs of destroyed Identities.
	Destroyed []jmap.ID `json:"destroyed,omitempty"`

	// NotCreated maps creation IDs to errors.
	NotCreated map[jmap.ID]*jmap.SetError `json:"notCreated,omitempty"`

	// NotUpdated maps Identity IDs to errors.
	NotUpdated map[jmap.ID]*jmap.SetError `json:"notUpdated,omitempty"`

	// NotDestroyed maps Identity IDs to errors.
	NotDestroyed map[jmap.ID]*jmap.SetError `json:"notDestroyed,omitempty"`
}

IdentitySetResponse is the response to Identity/set.

func (*IdentitySetResponse) Name

func (r *IdentitySetResponse) Name() string

Name implements jmap.MethodResponse.

type MDN

type MDN struct {
	// ForEmailID is the Email ID this MDN is for.
	ForEmailID jmap.ID `json:"forEmailId"`

	// Subject is the subject of the MDN message.
	Subject *string `json:"subject,omitempty"`

	// TextBody is the human-readable part of the MDN.
	TextBody *string `json:"textBody,omitempty"`

	// IncludeOriginalMessage includes the original message in the MDN.
	IncludeOriginalMessage bool `json:"includeOriginalMessage,omitempty"`

	// OriginalRecipient is the original recipient of the message.
	OriginalRecipient *string `json:"originalRecipient,omitempty"`

	// OriginalMessageID is the Message-ID of the original message.
	OriginalMessageID *string `json:"originalMessageId,omitempty"`

	// ReportingUA is the reporting user agent string.
	// BUG FIX: JSON tag MUST be "reportingUA" (not "reportinUA").
	ReportingUA *string `json:"reportingUA,omitempty"`

	// MDNGateway is the MDN gateway.
	MDNGateway *string `json:"mdnGateway,omitempty"`

	// DispositionType is the disposition type: "deleted", "dispatched",
	// "displayed", "processed".
	DispositionType string `json:"dispositionType"`

	// DispositionSendingMode is the sending mode: "MDN-sent-manually"
	// or "MDN-sent-automatically".
	DispositionSendingMode *string `json:"dispositionSendingMode,omitempty"`

	// DispositionDisplayMode is the display mode:
	// "MDN-displayed-manually" or "MDN-displayed-automatically".
	DispositionDisplayMode *string `json:"dispositionDisplayMode,omitempty"`

	// FinalRecipient is the final recipient of the original message.
	FinalRecipient *string `json:"finalRecipient,omitempty"`

	// Error contains error messages from the MDN.
	Error []string `json:"error,omitempty"`

	// ExtensionFields contains additional MDN fields.
	ExtensionFields map[string]string `json:"extensionFields,omitempty"`
}

MDN represents a Message Disposition Notification (RFC 9007 Section 3).

type MDNCapability

type MDNCapability struct{}

MDNCapability represents the urn:ietf:params:jmap:mdn capability (RFC 9007 Section 2).

func (*MDNCapability) New

func (c *MDNCapability) New() jmap.Capability

New implements jmap.Capability.

func (*MDNCapability) URI

func (c *MDNCapability) URI() jmap.URI

URI implements jmap.Capability.

type MDNParse

type MDNParse struct {
	// AccountID is the account to use for parsing.
	AccountID jmap.ID `json:"accountId"`

	// BlobIDs is the list of blob IDs to parse as MDNs.
	BlobIDs []jmap.ID `json:"blobIds"`
}

MDNParse is the MDN/parse method (RFC 9007 Section 5).

func (*MDNParse) Name

func (m *MDNParse) Name() string

Name implements jmap.Method.

func (*MDNParse) Requires

func (m *MDNParse) Requires() []jmap.URI

Requires implements jmap.Method.

type MDNParseResponse

type MDNParseResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// Parsed maps blob IDs to parsed MDN objects.
	Parsed map[jmap.ID]*MDN `json:"parsed,omitempty"`

	// NotParsable contains blob IDs that could not be parsed.
	NotParsable []jmap.ID `json:"notParsable,omitempty"`

	// NotFound contains blob IDs that were not found.
	NotFound []jmap.ID `json:"notFound,omitempty"`
}

MDNParseResponse is the response to MDN/parse.

func (*MDNParseResponse) Name

func (r *MDNParseResponse) Name() string

Name implements jmap.MethodResponse.

type MDNSend

type MDNSend struct {
	// AccountID is the account to use.
	AccountID jmap.ID `json:"accountId"`

	// IdentityID is the Identity to use for sending.
	IdentityID jmap.ID `json:"identityId"`

	// Send maps creation IDs to MDN objects to send.
	Send map[jmap.ID]*MDN `json:"send"`
}

MDNSend is the MDN/send method (RFC 9007 Section 4).

func (*MDNSend) Name

func (m *MDNSend) Name() string

Name implements jmap.Method.

func (*MDNSend) Requires

func (m *MDNSend) Requires() []jmap.URI

Requires implements jmap.Method.

type MDNSendResponse

type MDNSendResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// Sent maps creation IDs to sent MDN objects.
	Sent map[jmap.ID]*MDN `json:"sent,omitempty"`

	// NotSent maps creation IDs to errors.
	NotSent map[jmap.ID]*jmap.SetError `json:"notSent,omitempty"`
}

MDNSendResponse is the response to MDN/send.

func (*MDNSendResponse) Name

func (r *MDNSendResponse) Name() string

Name implements jmap.MethodResponse.

type Mailbox

type Mailbox struct {
	// ID is the server-assigned identifier for this mailbox.
	ID jmap.ID `json:"id,omitempty"`

	// Name is the user-visible name of the mailbox.
	Name string `json:"name"`

	// ParentID is the ID of the parent mailbox, or nil for top-level.
	ParentID *jmap.ID `json:"parentId"`

	// Role is the role of the mailbox, e.g. "inbox", "drafts", etc.
	Role *string `json:"role"`

	// SortOrder defines the sort position among sibling mailboxes.
	SortOrder uint32 `json:"sortOrder"`

	// TotalEmails is the total number of emails in the mailbox.
	TotalEmails uint64 `json:"totalEmails"`

	// UnreadEmails is the number of unread emails in the mailbox.
	UnreadEmails uint64 `json:"unreadEmails"`

	// TotalThreads is the total number of threads in the mailbox.
	TotalThreads uint64 `json:"totalThreads"`

	// UnreadThreads is the number of unread threads in the mailbox.
	UnreadThreads uint64 `json:"unreadThreads"`

	// MyRights describes the access rights for the current user.
	MyRights *MailboxRights `json:"myRights,omitempty"`

	// IsSubscribed indicates whether the mailbox is subscribed to.
	IsSubscribed bool `json:"isSubscribed"`
}

Mailbox represents a JMAP Mailbox object (RFC 8621 Section 2).

type MailboxChanges

type MailboxChanges struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// SinceState is the state string from a previous response.
	SinceState string `json:"sinceState"`

	// MaxChanges is the maximum number of changed IDs to return.
	MaxChanges *uint64 `json:"maxChanges,omitempty"`
}

MailboxChanges is the Mailbox/changes method (RFC 8621 Section 2.2).

func (*MailboxChanges) Name

func (m *MailboxChanges) Name() string

Name implements jmap.Method.

func (*MailboxChanges) Requires

func (m *MailboxChanges) Requires() []jmap.URI

Requires implements jmap.Method.

type MailboxChangesResponse

type MailboxChangesResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldState is the state string supplied by the client.
	OldState string `json:"oldState"`

	// NewState is the current state string after the changes.
	NewState string `json:"newState"`

	// HasMoreChanges indicates if there are more changes to fetch.
	HasMoreChanges bool `json:"hasMoreChanges"`

	// Created contains IDs of mailboxes created since the old state.
	Created []jmap.ID `json:"created"`

	// Updated contains IDs of mailboxes updated since the old state.
	Updated []jmap.ID `json:"updated"`

	// Destroyed contains IDs of mailboxes destroyed since the old state.
	Destroyed []jmap.ID `json:"destroyed"`
}

MailboxChangesResponse is the response to Mailbox/changes.

func (*MailboxChangesResponse) Name

func (r *MailboxChangesResponse) Name() string

Name implements jmap.MethodResponse.

type MailboxFilter

type MailboxFilter struct {
	// ParentID filters by parent mailbox. Nil matches top-level.
	ParentID *jmap.ID `json:"parentId,omitempty"`

	// Name filters by mailbox name (case-insensitive substring match).
	Name *string `json:"name,omitempty"`

	// Role filters by mailbox role.
	Role *string `json:"role,omitempty"`

	// HasAnyRole filters by whether the mailbox has any role.
	HasAnyRole *bool `json:"hasAnyRole,omitempty"`

	// IsSubscribed filters by subscription status.
	IsSubscribed *bool `json:"isSubscribed,omitempty"`
}

MailboxFilter is a filter for Mailbox/query (RFC 8621 Section 2.4).

type MailboxGet

type MailboxGet struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// IDs is the list of Mailbox IDs to retrieve. If nil, all are returned.
	IDs []jmap.ID `json:"ids,omitempty"`

	// Properties lists the properties to include. If nil, all are returned.
	Properties []string `json:"properties,omitempty"`
}

MailboxGet is the Mailbox/get method (RFC 8621 Section 2.1).

func (*MailboxGet) Name

func (m *MailboxGet) Name() string

Name implements jmap.Method.

func (*MailboxGet) Requires

func (m *MailboxGet) Requires() []jmap.URI

Requires implements jmap.Method.

type MailboxGetResponse

type MailboxGetResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// State is the current state string for this data type.
	State string `json:"state"`

	// List contains the requested Mailbox objects.
	List []*Mailbox `json:"list"`

	// NotFound contains IDs that were not found.
	NotFound []jmap.ID `json:"notFound"`
}

MailboxGetResponse is the response to Mailbox/get.

func (*MailboxGetResponse) Name

func (r *MailboxGetResponse) Name() string

Name implements jmap.MethodResponse.

type MailboxQuery

type MailboxQuery struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// Filter specifies conditions for the query.
	Filter *MailboxFilter `json:"filter,omitempty"`

	// Sort specifies the sort order for results.
	Sort []*MailboxSort `json:"sort,omitempty"`

	// Position is the zero-based index of the first result to return.
	Position int64 `json:"position,omitempty"`

	// Anchor is the ID of an item to use as the position reference.
	Anchor *jmap.ID `json:"anchor,omitempty"`

	// AnchorOffset is the offset from the anchor to the first result.
	AnchorOffset int64 `json:"anchorOffset,omitempty"`

	// Limit is the maximum number of results to return.
	Limit *uint64 `json:"limit,omitempty"`

	// CalculateTotal requests the server include a total count.
	CalculateTotal bool `json:"calculateTotal,omitempty"`

	// SortAsTree arranges results as a tree sorted by the given sort.
	SortAsTree bool `json:"sortAsTree,omitempty"`

	// FilterAsTree only includes mailboxes whose ancestors also match.
	FilterAsTree bool `json:"filterAsTree,omitempty"`
}

MailboxQuery is the Mailbox/query method (RFC 8621 Section 2.4).

func (*MailboxQuery) Name

func (m *MailboxQuery) Name() string

Name implements jmap.Method.

func (*MailboxQuery) Requires

func (m *MailboxQuery) Requires() []jmap.URI

Requires implements jmap.Method.

type MailboxQueryChanges

type MailboxQueryChanges struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// Filter specifies conditions for the query.
	Filter *MailboxFilter `json:"filter,omitempty"`

	// Sort specifies the sort order for results.
	Sort []*MailboxSort `json:"sort,omitempty"`

	// SinceQueryState is the query state from a previous Mailbox/query.
	SinceQueryState string `json:"sinceQueryState"`

	// MaxChanges is the maximum number of changes to return.
	MaxChanges *uint64 `json:"maxChanges,omitempty"`

	// UpToID limits changes to those up to and including this ID.
	UpToID *jmap.ID `json:"upToId,omitempty"`

	// CalculateTotal requests the server include a total count.
	CalculateTotal bool `json:"calculateTotal,omitempty"`
}

MailboxQueryChanges is the Mailbox/queryChanges method (RFC 8621 Section 2.6).

func (*MailboxQueryChanges) Name

func (m *MailboxQueryChanges) Name() string

Name implements jmap.Method.

func (*MailboxQueryChanges) Requires

func (m *MailboxQueryChanges) Requires() []jmap.URI

Requires implements jmap.Method.

type MailboxQueryChangesResponse

type MailboxQueryChangesResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldQueryState is the query state supplied by the client.
	OldQueryState string `json:"oldQueryState"`

	// NewQueryState is the current query state.
	NewQueryState string `json:"newQueryState"`

	// Removed contains IDs removed from the query results.
	Removed []jmap.ID `json:"removed"`

	// Added contains items added to the query results with their positions.
	Added []jmap.AddedItem `json:"added"`

	// Total is the total number of matching results, if requested.
	Total *uint64 `json:"total,omitempty"`
}

MailboxQueryChangesResponse is the response to Mailbox/queryChanges.

func (*MailboxQueryChangesResponse) Name

Name implements jmap.MethodResponse.

type MailboxQueryResponse

type MailboxQueryResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// QueryState is the current state of the query.
	QueryState string `json:"queryState"`

	// CanCalculateChanges indicates if the server supports queryChanges.
	CanCalculateChanges bool `json:"canCalculateChanges"`

	// Position is the zero-based index of the first result returned.
	Position uint64 `json:"position"`

	// IDs contains the IDs of the matching Mailbox objects.
	IDs []jmap.ID `json:"ids"`

	// Total is the total number of matching results, if requested.
	Total *uint64 `json:"total,omitempty"`

	// Limit is the limit that was applied to the query.
	Limit *uint64 `json:"limit,omitempty"`
}

MailboxQueryResponse is the response to Mailbox/query.

func (*MailboxQueryResponse) Name

func (r *MailboxQueryResponse) Name() string

Name implements jmap.MethodResponse.

type MailboxRights

type MailboxRights struct {
	MayReadItems   bool `json:"mayReadItems"`
	MayAddItems    bool `json:"mayAddItems"`
	MayRemoveItems bool `json:"mayRemoveItems"`
	MaySetSeen     bool `json:"maySetSeen"`
	MaySetKeywords bool `json:"maySetKeywords"`
	MayCreateChild bool `json:"mayCreateChild"`
	MayRename      bool `json:"mayRename"`
	MayDelete      bool `json:"mayDelete"`
	MaySubmit      bool `json:"maySubmit"`
}

MailboxRights represents the rights a user has on a mailbox.

type MailboxSet

type MailboxSet struct {
	// AccountID is the account to modify.
	AccountID jmap.ID `json:"accountId"`

	// IfInState only applies changes if the current state matches.
	IfInState *string `json:"ifInState,omitempty"`

	// Create maps creation IDs to Mailbox objects to create.
	Create map[jmap.ID]*Mailbox `json:"create,omitempty"`

	// Update maps Mailbox IDs to patch objects.
	Update map[jmap.ID]*jmap.Patch `json:"update,omitempty"`

	// Destroy is a list of Mailbox IDs to destroy.
	Destroy []jmap.ID `json:"destroy,omitempty"`

	// OnDestroyRemoveEmails, if true, removes emails that are only in
	// destroyed mailboxes rather than returning an error.
	OnDestroyRemoveEmails bool `json:"onDestroyRemoveEmails,omitempty"`
}

MailboxSet is the Mailbox/set method (RFC 8621 Section 2.5).

func (*MailboxSet) Name

func (m *MailboxSet) Name() string

Name implements jmap.Method.

func (*MailboxSet) Requires

func (m *MailboxSet) Requires() []jmap.URI

Requires implements jmap.Method.

type MailboxSetResponse

type MailboxSetResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldState is the state before the changes.
	OldState string `json:"oldState"`

	// NewState is the state after the changes.
	NewState string `json:"newState"`

	// Created maps creation IDs to created Mailbox objects.
	Created map[jmap.ID]*Mailbox `json:"created,omitempty"`

	// Updated maps Mailbox IDs to updated Mailbox objects.
	Updated map[jmap.ID]*Mailbox `json:"updated,omitempty"`

	// Destroyed contains IDs of destroyed Mailboxes.
	Destroyed []jmap.ID `json:"destroyed,omitempty"`

	// NotCreated maps creation IDs to errors.
	NotCreated map[jmap.ID]*jmap.SetError `json:"notCreated,omitempty"`

	// NotUpdated maps Mailbox IDs to errors.
	NotUpdated map[jmap.ID]*jmap.SetError `json:"notUpdated,omitempty"`

	// NotDestroyed maps Mailbox IDs to errors.
	NotDestroyed map[jmap.ID]*jmap.SetError `json:"notDestroyed,omitempty"`
}

MailboxSetResponse is the response to Mailbox/set.

func (*MailboxSetResponse) Name

func (r *MailboxSetResponse) Name() string

Name implements jmap.MethodResponse.

type MailboxSort

type MailboxSort struct {
	// Property is the Mailbox property to sort by.
	Property string `json:"property"`

	// IsAscending controls sort direction. Default is true.
	IsAscending *bool `json:"isAscending,omitempty"`
}

MailboxSort defines the sort order for Mailbox/query results.

type SMIMECapability

type SMIMECapability struct{}

SMIMECapability represents the urn:ietf:params:jmap:smimeverify capability (RFC 9219 Section 2).

func (*SMIMECapability) New

func (c *SMIMECapability) New() jmap.Capability

New implements jmap.Capability.

func (*SMIMECapability) URI

func (c *SMIMECapability) URI() jmap.URI

URI implements jmap.Capability.

type SMIMEErrors

type SMIMEErrors struct {
	// EmailID is the ID of the email with S/MIME errors.
	EmailID string `json:"emailId"`

	// Errors is the list of S/MIME verification error strings.
	Errors []string `json:"errors"`
}

SMIMEErrors contains S/MIME verification errors for an email (RFC 9219).

type SMIMEStatus

type SMIMEStatus string

SMIMEStatus represents the S/MIME verification status of an email (RFC 9219).

const (
	// SMIMEUnknown indicates the S/MIME status is unknown.
	SMIMEUnknown SMIMEStatus = "unknown"

	// SMIMESigned indicates the email is S/MIME signed.
	SMIMESigned SMIMEStatus = "signed"

	// SMIMEEncrypted indicates the email is S/MIME encrypted.
	SMIMEEncrypted SMIMEStatus = "encrypted"
)

type SearchSnippet

type SearchSnippet struct {
	// EmailID is the ID of the email this snippet is for.
	EmailID jmap.ID `json:"emailId"`

	// Subject is the highlighted subject, or nil if no match.
	Subject *string `json:"subject"`

	// Preview is the highlighted preview text, or nil if no match.
	Preview *string `json:"preview"`
}

SearchSnippet represents a JMAP SearchSnippet object (RFC 8621 Section 5).

type SearchSnippetGet

type SearchSnippetGet struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// Filter is the same filter used in the Email/query that produced
	// the email IDs.
	Filter *EmailFilter `json:"filter,omitempty"`

	// EmailIDs is the list of Email IDs to get snippets for.
	EmailIDs []jmap.ID `json:"emailIds"`
}

SearchSnippetGet is the SearchSnippet/get method (RFC 8621 Section 5.1).

func (*SearchSnippetGet) Name

func (m *SearchSnippetGet) Name() string

Name implements jmap.Method. BUG FIX: This MUST return "SearchSnippet/get", not "Mailbox/get".

func (*SearchSnippetGet) Requires

func (m *SearchSnippetGet) Requires() []jmap.URI

Requires implements jmap.Method.

type SearchSnippetGetResponse

type SearchSnippetGetResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// List contains the SearchSnippet objects.
	List []*SearchSnippet `json:"list"`

	// NotFound contains Email IDs that were not found.
	NotFound []jmap.ID `json:"notFound"`
}

SearchSnippetGetResponse is the response to SearchSnippet/get.

func (*SearchSnippetGetResponse) Name

func (r *SearchSnippetGetResponse) Name() string

Name implements jmap.MethodResponse.

type SubmissionCapability

type SubmissionCapability struct {
	// MaxDelayedSend is the maximum number of seconds a submission
	// may be delayed.
	MaxDelayedSend uint64 `json:"maxDelayedSend"`

	// SubmissionExtensions maps SMTP extension names to supported
	// parameter values.
	SubmissionExtensions map[string][]string `json:"submissionExtensions"`
}

SubmissionCapability represents the urn:ietf:params:jmap:submission capability (RFC 8621 Section 7).

func (*SubmissionCapability) New

New implements jmap.Capability.

func (*SubmissionCapability) URI

func (c *SubmissionCapability) URI() jmap.URI

URI implements jmap.Capability.

type Thread

type Thread struct {
	// ID is the server-assigned identifier for this thread.
	ID jmap.ID `json:"id"`

	// EmailIDs is the list of Email IDs in this thread, sorted by date.
	EmailIDs []jmap.ID `json:"emailIds"`
}

Thread represents a JMAP Thread object (RFC 8621 Section 3).

type ThreadChanges

type ThreadChanges struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// SinceState is the state string from a previous response.
	SinceState string `json:"sinceState"`

	// MaxChanges is the maximum number of changed IDs to return.
	MaxChanges *uint64 `json:"maxChanges,omitempty"`
}

ThreadChanges is the Thread/changes method (RFC 8621 Section 3.2).

func (*ThreadChanges) Name

func (m *ThreadChanges) Name() string

Name implements jmap.Method.

func (*ThreadChanges) Requires

func (m *ThreadChanges) Requires() []jmap.URI

Requires implements jmap.Method.

type ThreadChangesResponse

type ThreadChangesResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldState is the state string supplied by the client.
	OldState string `json:"oldState"`

	// NewState is the current state string after the changes.
	NewState string `json:"newState"`

	// HasMoreChanges indicates if there are more changes to fetch.
	HasMoreChanges bool `json:"hasMoreChanges"`

	// Created contains IDs of threads created since the old state.
	Created []jmap.ID `json:"created"`

	// Updated contains IDs of threads updated since the old state.
	Updated []jmap.ID `json:"updated"`

	// Destroyed contains IDs of threads destroyed since the old state.
	Destroyed []jmap.ID `json:"destroyed"`
}

ThreadChangesResponse is the response to Thread/changes.

func (*ThreadChangesResponse) Name

func (r *ThreadChangesResponse) Name() string

Name implements jmap.MethodResponse.

type ThreadGet

type ThreadGet struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// IDs is the list of Thread IDs to retrieve.
	IDs []jmap.ID `json:"ids,omitempty"`
}

ThreadGet is the Thread/get method (RFC 8621 Section 3.1).

func (*ThreadGet) Name

func (m *ThreadGet) Name() string

Name implements jmap.Method.

func (*ThreadGet) Requires

func (m *ThreadGet) Requires() []jmap.URI

Requires implements jmap.Method.

type ThreadGetResponse

type ThreadGetResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// State is the current state string for this data type.
	State string `json:"state"`

	// List contains the requested Thread objects.
	List []*Thread `json:"list"`

	// NotFound contains IDs that were not found.
	NotFound []jmap.ID `json:"notFound"`
}

ThreadGetResponse is the response to Thread/get.

func (*ThreadGetResponse) Name

func (r *ThreadGetResponse) Name() string

Name implements jmap.MethodResponse.

type VacationResponse

type VacationResponse struct {
	// ID is the singleton ID, always "singleton".
	ID jmap.ID `json:"id,omitempty"`

	// IsEnabled indicates whether the vacation response is active.
	IsEnabled bool `json:"isEnabled"`

	// FromDate is the start date for the vacation response (RFC 3339).
	FromDate *string `json:"fromDate"`

	// ToDate is the end date for the vacation response (RFC 3339).
	ToDate *string `json:"toDate"`

	// Subject is the subject of the vacation response.
	Subject *string `json:"subject"`

	// TextBody is the plain-text body of the vacation response.
	TextBody *string `json:"textBody"`

	// HTMLBody is the HTML body of the vacation response.
	HTMLBody *string `json:"htmlBody"`

	// IsActivated indicates the server is currently sending
	// vacation responses.
	IsActivated bool `json:"isActivated,omitempty"`
}

VacationResponse represents a JMAP VacationResponse object (RFC 8621 Section 8).

func (*VacationResponse) MarshalJSON

func (v *VacationResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for VacationResponse. BUG FIX: This method MUST be named MarshalJSON (not MarshalJson). It ensures null fields are explicitly included rather than omitted.

type VacationResponseCapability

type VacationResponseCapability struct{}

VacationResponseCapability represents the urn:ietf:params:jmap:vacationresponse capability (RFC 8621 Section 8).

func (*VacationResponseCapability) New

New implements jmap.Capability.

func (*VacationResponseCapability) URI

URI implements jmap.Capability.

type VacationResponseGet

type VacationResponseGet struct {
	// AccountID is the account to query.
	AccountID jmap.ID `json:"accountId"`

	// IDs is the list of VacationResponse IDs to retrieve.
	IDs []jmap.ID `json:"ids,omitempty"`

	// Properties lists the properties to include.
	Properties []string `json:"properties,omitempty"`
}

VacationResponseGet is the VacationResponse/get method (RFC 8621 Section 8.1).

func (*VacationResponseGet) Name

func (m *VacationResponseGet) Name() string

Name implements jmap.Method.

func (*VacationResponseGet) Requires

func (m *VacationResponseGet) Requires() []jmap.URI

Requires implements jmap.Method.

type VacationResponseGetResponse

type VacationResponseGetResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// State is the current state string for this data type.
	State string `json:"state"`

	// List contains the requested VacationResponse objects.
	List []*VacationResponse `json:"list"`

	// NotFound contains IDs that were not found.
	NotFound []jmap.ID `json:"notFound"`
}

VacationResponseGetResponse is the response to VacationResponse/get.

func (*VacationResponseGetResponse) Name

Name implements jmap.MethodResponse.

type VacationResponseSet

type VacationResponseSet struct {
	// AccountID is the account to modify.
	AccountID jmap.ID `json:"accountId"`

	// IfInState only applies changes if the current state matches.
	IfInState *string `json:"ifInState,omitempty"`

	// Update maps VacationResponse IDs to patch objects.
	Update map[jmap.ID]*jmap.Patch `json:"update,omitempty"`
}

VacationResponseSet is the VacationResponse/set method (RFC 8621 Section 8.2).

func (*VacationResponseSet) Name

func (m *VacationResponseSet) Name() string

Name implements jmap.Method.

func (*VacationResponseSet) Requires

func (m *VacationResponseSet) Requires() []jmap.URI

Requires implements jmap.Method.

type VacationResponseSetResponse

type VacationResponseSetResponse struct {
	// AccountID is the account this response is for.
	AccountID jmap.ID `json:"accountId"`

	// OldState is the state before the changes.
	OldState string `json:"oldState"`

	// NewState is the state after the changes.
	NewState string `json:"newState"`

	// Updated maps VacationResponse IDs to updated objects.
	Updated map[jmap.ID]*VacationResponse `json:"updated,omitempty"`

	// NotUpdated maps VacationResponse IDs to errors.
	NotUpdated map[jmap.ID]*jmap.SetError `json:"notUpdated,omitempty"`
}

VacationResponseSetResponse is the response to VacationResponse/set.

func (*VacationResponseSetResponse) Name

Name implements jmap.MethodResponse.

Jump to

Keyboard shortcuts

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