Documentation
¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) Connect() error
- func (c *Client) Messages(mailbox string) iter.Seq2[*Message, error]
- func (c *Client) Monitor(mailbox string) (_ <-chan *EventNewMessages, stop func() error, _ error)
- func (c *Client) Move(uids []uint32, mailbox string) error
- func (c *Client) Upload(path, mailbox string, ts time.Time) error
- type Config
- type DebugWriter
- type DryClient
- type Envelope
- type ErrMalformedMsg
- type EventNewMessages
- type Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient creates an new IMAP-Client. *Client.Connect must be called before any other methods.
func (*Client) Messages ¶
Messages returns an iterator over the messages in mailbox. When an error happens a nil message and an error is passed via the yield function.
func (*Client) Monitor ¶
func (c *Client) Monitor(mailbox string) ( _ <-chan *EventNewMessages, stop func() error, _ error, )
Monitor starts to monitor mailbox for new messages. When new messages are found an event is sent to ch. Message delivery to ch must not block. If delievery would block the message is discarded.
While Monitor is running, running other IMAP operations will block forever! To issue other IMAP operations, the returned stop function must be called before!
type Config ¶
type Config struct {
// Address is the address of the IMAP server. If the port is "993" or
// "imaps" an implicit TLS (SSL) is established.
// Otherwise a explicitl TLS (STARTTLS) connection is established.
Address string
User string
Password string
// AllowInsecure enables falling back to establishing the
// connection without encryption when the server does not support TLS
AllowInsecure bool
Logger *slog.Logger
// LogIMAPData enables logging raw IMAP protocol data with debug
// priority, it can contain sensitive information
LogIMAPData bool
}
type DebugWriter ¶ added in v0.5.1
type DebugWriter struct {
// contains filtered or unexported fields
}
func NewDebugWriter ¶ added in v0.5.1
func NewDebugWriter(l *slog.Logger) *DebugWriter
type DryClient ¶
type DryClient struct {
*Client
}
DryClient is an IMAP client that simulates operations that do changes on the IMAP-Server.
func NewDryClient ¶
NewDryClient creates an new IMAP-Client. [*DryClient.Connect] must be called before any other methods.
type ErrMalformedMsg ¶ added in v0.5.1
func NewErrMalformedMsg ¶ added in v0.5.1
func NewErrMalformedMsg(err string, uid uint32) *ErrMalformedMsg
func (*ErrMalformedMsg) Error ¶ added in v0.5.1
func (e *ErrMalformedMsg) Error() string
type EventNewMessages ¶
type EventNewMessages struct {
NewMsgCount uint32
}