Documentation ¶
Index ¶
- Constants
- Variables
- func SMTPErrorf(code int, format string, a ...interface{}) *smtp.SMTPError
- type Action
- type Addr
- type LMTPBackend
- type LMTPServer
- type LMTPSession
- type List
- type ListInfo
- type ListRepo
- type Logger
- type Membership
- type Status
- type Ulist
- func (u *Ulist) AddMembers(list *List, sendWelcome bool, addrs []*Addr, ...) []error
- func (u *Ulist) CheckbackJoinUrl(list *List, recipient *Addr) (string, error)
- func (u *Ulist) CheckbackLeaveUrl(list *List, recipient *Addr) (string, error)
- func (u *Ulist) CreateList(address, name, rawAdminMods string, reason string) (*List, []error)
- func (u *Ulist) DeleteModeratedMail(list *List, filename string) error
- func (u *Ulist) Forward(list *List, m *mailutil.Message) error
- func (u *Ulist) GetAction(list *List, header mail.Header, froms []*Addr) (Action, string, error)
- func (u *Ulist) GetRoles(list *List, addr *Addr) ([]Status, error)
- func (u *Ulist) Notify(list *List, recipient string, subject string, body io.Reader) error
- func (u *Ulist) NotifyMods(list *List, mods []string) error
- func (u *Ulist) Open(list *List, filename string) (*os.File, error)
- func (u *Ulist) ReadHeader(list *List, filename string) (mail.Header, error)
- func (u *Ulist) ReadMessage(list *List, filename string) (*mailutil.Message, error)
- func (u *Ulist) RemoveMembers(list *List, sendGoodbye bool, addrs []*Addr, reason string) []error
- func (u *Ulist) Save(list *List, m *mailutil.Message) error
- func (u *Ulist) SendJoinCheckback(list *List, recipient *Addr) error
- func (u *Ulist) SendLeaveCheckback(list *List, user *Addr) (bool, error)
- func (u *Ulist) SignoffJoinMessage(list *List, member *Addr) (*bytes.Buffer, error)
- func (u *Ulist) StorageFolder(li ListInfo) string
Constants ¶
const BounceAddressSuffix = "+bounces"
const WebBatchLimit = 1000
Variables ¶
var ErrLink = errors.New("link is invalid or expired") // HMAC related, don't leak the reason
var ErrUnknownActionString = errors.New("unknown action string")
var SMTPErrUserNotExist = SMTPErrorf(550, "user not found")
Functions ¶
func SMTPErrorf ¶
Types ¶
type Action ¶ added in v0.13.0
type Action int
func ParseAction ¶ added in v0.13.0
func (Action) EqualsPass ¶ added in v0.13.0
func (Action) EqualsReject ¶ added in v0.13.0
type LMTPBackend ¶
type LMTPBackend struct {
Ulist *Ulist
}
func (LMTPBackend) AnonymousLogin ¶
func (lb LMTPBackend) AnonymousLogin(_ *smtp.ConnectionState) (smtp.Session, error)
func (LMTPBackend) Login ¶
func (LMTPBackend) Login(_ *smtp.ConnectionState, _, _ string) (smtp.Session, error)
type LMTPServer ¶ added in v0.13.0
func NewLMTPServer ¶ added in v0.13.0
func NewLMTPServer(ul *Ulist) LMTPServer
type LMTPSession ¶
implements smtp.Session
func (*LMTPSession) Data ¶
func (s *LMTPSession) Data(r io.Reader) error
"DATA". Finishes a transaction.
func (*LMTPSession) Logout ¶
func (*LMTPSession) Logout() error
func (*LMTPSession) Mail ¶
func (s *LMTPSession) Mail(envelopeFrom string, _ smtp.MailOptions) error
"MAIL FROM". Starts a new mail transaction.
func (*LMTPSession) Rcpt ¶
func (s *LMTPSession) Rcpt(to string) error
"RCPT TO". Can be called multiple times for multiple recipients.
func (*LMTPSession) Reset ¶
func (s *LMTPSession) Reset()
"RSET". Aborts the current mail transaction.
type List ¶ added in v0.13.0
type List struct { ListInfo HMACKey []byte // [32]byte would require check when reading from database PublicSignup bool // default: false HideFrom bool // default: false ActionMod Action ActionMember Action ActionKnown Action ActionUnknown Action }
func (*List) CreateHMAC ¶ added in v0.13.0
CreateHMAC creates an HMAC with a given user email address and the current time. The HMAC is returned as a base64 RawURLEncoding string.
func (*List) SignoffLeaveMessage ¶ added in v0.13.0
type ListInfo ¶ added in v0.13.0
func (*ListInfo) BounceAddress ¶ added in v0.13.0
func (*ListInfo) NewMessageId ¶ added in v0.13.0
NewMessageId creates a new RFC5322 compliant Message-Id with the list domain as "id-right".
func (*ListInfo) PrefixSubject ¶ added in v0.13.0
type ListRepo ¶ added in v0.13.0
type ListRepo interface { AddKnowns(list *List, addrs []*Addr) ([]*Addr, error) AddMembers(list *List, addrs []*Addr, receive, moderate, notify, admin bool) ([]*Addr, error) Admins(list *List) ([]string, error) AllLists() ([]ListInfo, error) Create(address, name string) (*List, error) Delete(list *List) error GetList(list *Addr) (*List, error) Members(list *List) ([]Membership, error) GetMembership(list *List, user *Addr) (Membership, error) IsList(addr *Addr) (bool, error) IsMember(list *List, addr *Addr) (bool, error) IsKnown(list *List, rawAddress string) (bool, error) Knowns(list *List) ([]string, error) Memberships(member *Addr) ([]Membership, error) Notifieds(list *List) ([]string, error) PublicLists() ([]ListInfo, error) Receivers(list *List) ([]string, error) RemoveKnowns(list *List, addrs []*Addr) ([]*mailutil.Addr, error) RemoveMembers(list *List, addrs []*Addr) ([]*Addr, error) Update(list *List, display string, publicSignup, hideFrom bool, actionMod, actionMember, actionKnown, actionUnknown Action) error UpdateMember(list *List, rawAddress string, receive, moderate, notify, admin bool) error }
type Membership ¶ added in v0.13.0
type Ulist ¶ added in v0.13.0
type Ulist struct { DummyMode bool GDPRLogger Logger Lists ListRepo LMTPSock string MTA mailutil.MTA SpoolDir string Superadmin string // RFC5322 AddrSpec, can create new mailing lists and modify all mailing lists WebURL string LastLogID uint32 Waiting sync.WaitGroup }
func (*Ulist) AddMembers ¶ added in v0.13.0
func (*Ulist) CheckbackJoinUrl ¶ added in v0.13.0
func (*Ulist) CheckbackLeaveUrl ¶ added in v0.13.0
func (*Ulist) CreateList ¶ added in v0.13.0
func (*Ulist) DeleteModeratedMail ¶ added in v0.13.0
func (*Ulist) Forward ¶ added in v0.13.0
Forwards a message over the given mailing list. This is the main job of this software.
func (*Ulist) GetAction ¶ added in v0.13.0
GetAction determines the maximum action of an email by the "From" addresses and possible spam headers. It also returns a human-readable reason for the decision.
The SMTP envelope sender is ignored, because it's actually something different and a case for the spam filtering system. (Mailman incorporates it last, which is probably never, because each email must have a From header: https://mail.python.org/pipermail/mailman-users/2017-January/081797.html)
func (*Ulist) Notify ¶ added in v0.13.0
Notify notifies recipients about something related to the list.
func (*Ulist) NotifyMods ¶ added in v0.13.0
appends a footer
func (*Ulist) ReadHeader ¶ added in v0.13.0
func (*Ulist) ReadMessage ¶ added in v0.13.0
func (*Ulist) RemoveMembers ¶ added in v0.13.0
func (*Ulist) Save ¶ added in v0.13.0
Saves the message into an eml file with a unique name within the storage folder. The filename is not returned.
func (*Ulist) SendJoinCheckback ¶ added in v0.13.0
SendJoinCheckback does not check the authorization of the asking person. This must be done by the caller.
func (*Ulist) SendLeaveCheckback ¶ added in v0.13.0
SendLeaveCheckback sends a checkback email if the user is a member of the list.
If the user is not a member, the returned error is nil, so it doesn't reveal about the membership. However both timing and other errors can still reveal it.
The returned bool value indicates whether the email was sent.