Documentation
¶
Overview ¶
Package email provides functionality for an email inbox with multiple SMTP servers and IMAP clients.
Index ¶
- Constants
- func NewSmtpPool(configs []SMTPConfig) ([]*smtppool.Pool, error)
- type Config
- type Email
- func (e *Email) Channel() string
- func (e *Email) Close() error
- func (e *Email) FromAddress() string
- func (e *Email) Identifier() int
- func (e *Email) ReadIncomingMessages(ctx context.Context, cfg IMAPConfig) error
- func (e *Email) Receive(ctx context.Context) error
- func (e *Email) Send(m models.Message) error
- type IMAPConfig
- type Opts
- type SMTPConfig
Constants ¶
const (
ChannelEmail = "email"
)
Variables ¶
This section is empty.
Functions ¶
func NewSmtpPool ¶
func NewSmtpPool(configs []SMTPConfig) ([]*smtppool.Pool, error)
NewSmtpPool returns a smtppool
Types ¶
type Config ¶
type Config struct { SMTP []SMTPConfig `json:"smtp"` IMAP []IMAPConfig `json:"imap"` From string `json:"from"` }
Config holds the email inbox configuration with multiple SMTP servers and IMAP clients.
type Email ¶
type Email struct {
// contains filtered or unexported fields
}
Email represents the email inbox with multiple SMTP servers and IMAP clients.
func (*Email) FromAddress ¶
FromAddress returns the from address for this inbox.
func (*Email) Identifier ¶
Identifier returns the unique identifier of the inbox which is the database ID.
func (*Email) ReadIncomingMessages ¶
func (e *Email) ReadIncomingMessages(ctx context.Context, cfg IMAPConfig) error
ReadIncomingMessages reads and processes incoming messages from an IMAP server based on the provided configuration.
type IMAPConfig ¶
type IMAPConfig struct { Host string `json:"host"` Port int `json:"port"` Username string `json:"username"` Password string `json:"password"` Mailbox string `json:"mailbox"` ReadInterval string `json:"read_interval"` ScanInboxSince string `json:"scan_inbox_since"` TLSType string `json:"tls_type"` TLSSkipVerify bool `json:"tls_skip_verify"` }
IMAPConfig holds IMAP client credentials and configuration.
type SMTPConfig ¶
type SMTPConfig struct { Username string `json:"username"` Password string `json:"password"` AuthProtocol string `json:"auth_protocol"` TLSType string `json:"tls_type"` TLSSkipVerify bool `json:"tls_skip_verify"` EmailHeaders map[string]string `json:"email_headers"` smtppool.Opt `json:",squash"` // SMTP pool options. }
SMTPConfig represents an SMTP server's credentials with the smtppool options.