Documentation ¶
Index ¶
- Constants
- func NewBot(backend Backend) *bot
- func NewBotFactory(backend Backend) botFactory
- func NewList(backend Backend, definition Definition) *list
- func SendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) error
- type Backend
- type BounceResponse
- type Command
- type Config
- type Definition
- type Message
- func (msg *Message) FromReader(stream io.Reader) error
- func (msg *Message) Reply() *Message
- func (msg *Message) ResendAs(list *list, commandAddress string) *Message
- func (msg *Message) Send(envelopeSender string, recipients []string, SMTPHostname string, ...) error
- func (msg *Message) SendDebug(envelopeSender string, recipients []string) string
- func (msg *Message) SendVERP(envelopeSender string, recipients []string, SMTPHostname string, ...) error
- func (msg *Message) String() string
- type Subscription
Constants ¶
const BounceInterval = 7 * 24 * time.Hour
BounceInterval is used to compute ban times when bouncing
Variables ¶
This section is empty.
Functions ¶
func NewBotFactory ¶
func NewBotFactory(backend Backend) botFactory
NewBotFactory creates a bot factory from a bot
func NewList ¶
func NewList(backend Backend, definition Definition) *list
NewList creates a new list from a backend and a definition
Types ¶
type Backend ¶
type Backend interface { Config() Config Lists() ([]Definition, error) CreateList(Definition) error ModifyList(string, Definition) error DeleteList(string) error LookupList(string) (*Definition, error) ListSubscribe(Definition, string) error ListUnsubscribe(Definition, string) error ListSetBounce(Definition, string, uint16, time.Time) error ListSubscribers(Definition) ([]Subscription, error) ListIsSubscribed(Definition, string) (*Subscription, error) }
A Backend can be used to create a bot
type BounceResponse ¶
A BounceResponse represents an incoming mail on the bounce address with a list and an address specified as parameter
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
A Command represents a command parser
func AddCommand ¶
func AddCommand(app *kingpin.Application, admin bool, userAddress string, botFactory botFactory) *Command
AddCommand adds bot commands to a given kingpin application
func NewCommand ¶
NewCommand returns a Command application object
type Config ¶
type Config struct { CommandAddress string `ini:"command_address"` BouncesAddress string `ini:"bounces_address"` AdminAddresses []string `ini:"admin_addresses"` SMTPHostname string `ini:"smtp_hostname"` SMTPPort uint64 `ini:"smtp_port"` SMTPUsername string `ini:"smtp_username"` SMTPPassword string `ini:"smtp_password"` Debug bool `ini:"debug"` }
A Config represents general configuration for a mailing list bot
type Definition ¶
type Definition struct { Address string `ini:"address"` Name string `ini:"name"` Description string `ini:"description"` Hidden bool `ini:"hidden"` Locked bool `ini:"locked"` SubscribersOnly bool `ini:"subscribers_only"` Posters []string `ini:"posters,omitempty"` Bcc []string `ini:"bcc,omitempty"` }
A Definition defines a list definition
func (Definition) String ¶
func (def Definition) String() string
type Message ¶
type Message struct { Subject string From string To string Cc string Bcc string Date string Sender string Address string InReplyTo string Precedence string ListID string ListUnsubscribe string ListSubscribe string ListArchive string ListOwner string ListHelp string XMailingList string XLoop string MIMEVersion string ContentType string Headers map[string][]string Body []byte }
Message represents an e-mail message
func (*Message) FromReader ¶
FromReader reads a message from the given io.Reader
func (*Message) ResendAs ¶
ResendAs a list prepares a copy of the message to be used for a list forward
func (*Message) Send ¶
func (msg *Message) Send(envelopeSender string, recipients []string, SMTPHostname string, SMTPPort uint64, SMTPUsername string, SMTPPassword string, debug bool) error
Send a Message
func (*Message) SendDebug ¶
SendDebug returns a string describing the message that would be sent, and its recipients