Versions in this module Expand all Collapse all v0 v0.0.3 Oct 25, 2024 v0.0.2 Oct 25, 2024 v0.0.1 Oct 21, 2024 Changes in this version + const Accept + const ActionNameField + const AllHeaders + const AllowLocalhostConnection + const Archive + const Authorization + const Custom + const DecisionKey + const DefaultAddress + const DefaultDataReceivingTimeoutSec + const DefaultDataStartReceivingTimeoutSec + const DefaultFilePerm + const DefaultFolderPerm + const DefaultListenerMaxMessageSizeInBytes + const DefaultListenerMaxMessageSizeInMB + const DefaultListenerMaxRecipientsPerMessage + const DefaultListenerNameFormat + const DefaultListenerVersion + const DefaultMaxConnections + const DefaultMaxErrorPerConnection + const DefaultProtocolTimeoutSec + const DeliveryQueued + const DeliveryRejected + const DeliveryStatusField + const Draft + const Dunno + const ForPublicField + const FromField + const HasField + const ImapFlagAnswered + const ImapFlagDeleted + const ImapFlagDraft + const ImapFlagFlagged + const ImapFlagSeen + const Inbox + const LimitField + const ListenAddress + const LmtpService + const MailHeader + const MessageUidField + const OkResponse + const OkResponseFmt + const OriginalValue + const PrivateHeader + const ReceiveFromLocalUsers + const ReceiveFromNullSender + const ReceiveFromRemoteUsers + const Reject + const RequireLocalHostAuthorization + const Sent + const Spam + const StartTls + const ToField + const Trash + const XForwardedToHeader + var Commands = make(map[string]CommandHandler) + var NativeEndian binary.ByteOrder + var RegisteredCommands []string + func AllowAuthorize(service api.Service, mb *api.Mailbox, useSsl api.Maybe) bool + func CheckErrorsCount(client *Client, maxErrorsPerConnection int) + func DefaultNewFileFromDelivery(proxy MessageReceiverProxy, delivery Delivery, hostName string, ...) (filename string, dataSize int64, err error) + func DeliveryAddHeaderAs(d *Delivery, name, value string, first bool) + func DeliveryDelHeader(d *Delivery, name string) + func DeliverySetHeader(d *Delivery, name string, value string, first bool) + func DovecotMessageFilenameV2(delivery *Delivery, proxy MessageReceiverProxy, hostname string, ...) string + func FilterSendCopyToEmails(logger *slog.Logger, mb *api.Mailbox, supervisor api.Supervisor, ...) []string + func GetAbsoluteMaildirPath(defaultMailStorePath string, mb *api.Mailbox) string + func GetSendCopyTo(logger *slog.Logger, fromMailerDaemon bool, mb *api.Mailbox, ...) (sendCopiesTo []string) + func HaveCapacity(mb *api.Mailbox, needCapacity int64) bool + func IsBlacklisted(mb *api.Mailbox, asciiEmailLowerCase string) bool + func IsRejectErr(err error) bool + func IsWhitelisted(mb *api.Mailbox, asciiEmailLowerCase string) bool + func MimeHeadersSliceToString(headers []string) string + func MimeHeadersSliceToStringLength(headers []string, maxLength int) string + func MimeHeadersToString(h textproto.MIMEHeader) string + func MimeHeadersToStringWithOrder(h textproto.MIMEHeader, order []string) string + func NewFileFromMailboxDelivery(proxy MessageReceiverProxy, delivery Delivery, hostName string, ...) (filename string, dataSize int64, err error) + func NewPostmasterAddressEmail() + func NewRejectErr(code RejectErrCode) error + func NewRejectErrMessage(code RejectErrCode, message string) error + func OpenFile(filename string, flag int, perms os.FileMode) (f *os.File, err error) + func RegisterCommand(name string, cmd CommandHandler) + func RejectCodeToMessage(code RejectErrCode) string + func RejectCodeToMessageWithMyMessage(code RejectErrCode, appendMessage string) string + func SendAllRequiredCopies(logger *slog.Logger, fromMailerDaemon bool, originalRecipient string, ...) + func SendAutoresponseMessage(logger *slog.Logger, msg *mail.Message, mb *api.Mailbox, d *Delivery) (string, *mimemsg.Message) + func StoreMessage(appendBytes []byte, proxy MessageReceiverProxy, delivery Delivery, ...) (fileSize int64, err error) + func StoreMessageFromWriter(appendBytes []byte, wrto io.WriterTo, filename string) (fileSize int64, err error) + func TryOpenFile(filename string, howManyTries int, sleepStep time.Duration, flag int, ...) (f *os.File, err error) + func ValidEmail(value string) api.Maybe + func WrapText(w io.Writer, text string, newline, indent, preIndent string, width int) + type AddressEmail struct + Host string + Username string + func NewAddressEmail(username, host string) AddressEmail + func NewAddressEmailSanitize(value string) (AddressEmail, bool) + func SanitizeEmailAddress(value string) AddressEmail + func (a AddressEmail) IsEmpty() bool + func (a AddressEmail) IsEqual(another AddressEmail) bool + func (a AddressEmail) IsValid() bool + func (e AddressEmail) String() string + type AuthorizationHandler func(username string, password string) (bool, error) + type Client struct + Con net.Conn + CurrentClientNo int32 + DataStartReceivingTimeoutDuration time.Duration + DidHeloCmd bool + DidStartTlsNotAllowed bool + ErrorsCount int + Flags bitmask.Flag64 + Helo string + Info ConnectionInfo + ListenerAppName string + ListenerReverseHostname string + MaxErrorsPerConnection int + MaxMessageSizeInBytes int64 + MaxRecipientsPerMessage int + Password string + ProtocolTimeoutDuration time.Duration + RejectInfo []string + Session Session + Text *textproto.Conn + UseEhlo bool + Username string + WeClose bool + WhenConnected time.Time + func (c *Client) AuthLoginGetPassword(cmd string) + func (c *Client) AuthLoginGetUsername(cmd string) + func (c *Client) AuthMe(username, password string) bool + func (c *Client) Cmd(expectCode int, format string, args ...interface{}) (int, string, error) + func (c *Client) DidHelo() bool + func (c *Client) DidMailFrom() bool + func (c *Client) DidRecipient() bool + func (c *Client) GetHello() string + func (c *Client) GetInfo() ConnectionInfo + func (c *Client) GetPassword() string + func (c *Client) GetSession() Session + func (c *Client) GetUsername() string + func (c *Client) IsLoggedIn() bool + func (c *Client) ReadLine() (string, error) + func (c *Client) UnknownCommand(cmd string, msg string) + func (c *Client) WriteCmd(s string) (err error) + type CommandHandler func(c *Client, supervisor api.Supervisor, args string) + type Connection interface + GetHello func() string + GetInfo func() ConnectionInfo + GetPassword func() string + GetUsername func() string + type ConnectionInfo struct + Flags bitmask.Flag64 + Id int64 + InstanceId int + LocalAddr string + RemoteAddr string + ReverseHostName string + StartConnection time.Time + UUId string + func NewConnectionInfo(id int64, flags bitmask.Flag64) ConnectionInfo + type ConnectionState struct + func NewConnectionState(flags bitmask.Flag64) ConnectionState + func (mp ConnectionState) Close() + type Decision string + func (d Decision) String() string + type Delivery struct + CustomMailbox string + Flags ImapFlag + From AddressEmail + IsPassed bool + IsRecent bool + Mailbox Maildir + MessageNo uint32 + To AddressEmail + UniqueId string + func CloneDelivery(src *Delivery, toMailBox Maildir) Delivery + func NewDelivery(from, to AddressEmail) Delivery + func NewDeliveryFromClient(client Connection, from, to AddressEmail) Delivery + func (d *Delivery) Close() + func (d *Delivery) HeaderContainsPattern(msg *mail.Message, names []string, patterns ...string) bool + func (d *Delivery) HeaderValues(msg *mail.Message, key string) (ret []string) + func (d *Delivery) MatchHeader(msg *mail.Message, name string, matcher func(value string) bool) bool + func (d *Delivery) SpoolDir(basePath string) string + func (d Delivery) GetHeader(msg *mail.Message, name string) string + func (d Delivery) HeaderToString() string + type DeliveryProxy interface + AddHeader func(name, value string) + DelHeader func(name string) + Filesize func() int + GetCustomMailbox func() string + GetFrom func() AddressEmail + GetImapFlags func() ImapFlag + GetMailbox func() Maildir + GetTo func() AddressEmail + GetUniqueId func() string + IsRecent func() bool + SetHeader func(name string, value string) + type EmailAddressType int + type ImapFlag map[string]bool + func (i ImapFlag) Delete(key string) + func (i ImapFlag) IsSet(key string) bool + func (i ImapFlag) Keys() []string + func (i ImapFlag) Set(key string) + func (i ImapFlag) String() string + type Listener struct + DataReceivingTimeoutDuration time.Duration + DataStartReceivingTimeoutDuration time.Duration + MaxConnections int + MaxErrorsPerConnection int + MaxMessageSizeInBytes int64 + MaxRecipientsPerMessage int + ProtocolTimeoutDuration time.Duration + func NewDefaultListener() *Listener + func NewDefaultListenerExt(address, reverseHostname string, flags bitmask.Flag64) *Listener + func NewDefaultListenerWithAddress(address string) *Listener + func NewListener(address string, maxErrorsPerConnection int, maxConnections int, ...) *Listener + func NewLmtp(hostname string) *Listener + func (l *Listener) Address() string + func (l *Listener) Listen() (err error) + func (l *Listener) Run(ctx context.Context, supervisor SupervisorExt, cancelFunc context.CancelFunc) error + func (l *Listener) Stop() + type Maildir string + func ToMailDir(emailLowerAsciiString string) Maildir + func (m Maildir) CreateNewMailDirIfNotExists(basePath string, customValue string, folderPerm, filePerm os.FileMode) (string, error) + func (m Maildir) Path(basePath string, customValue string) string + type MessageReceiver struct + func NewMessageReceiver() MessageReceiver + func (mr *MessageReceiver) AcceptData(ctx context.Context, c *Client, r io.Reader) (err error) + func (mr *MessageReceiver) AcceptRecipient(currentHostname string, from, to AddressEmail, client *Client) bool + func (mr *MessageReceiver) ArrivalTime() time.Time + func (mr *MessageReceiver) Close() + func (mr *MessageReceiver) GetBodyOffset() int64 + func (mr *MessageReceiver) GetBuffer() *filebuf.Buf + func (mr *MessageReceiver) GetMessage() *mail.Message + func (mr *MessageReceiver) InitialMessageSize() int + func (mr *MessageReceiver) MoveBufferPosToMessageStartLine() error + func (mr *MessageReceiver) MoveBufferPosToStart() error + func (mr *MessageReceiver) RecipientsCount() int + func (mr *MessageReceiver) SeekMessage(client *Client, offset int64, whence int) bool + func (mr *MessageReceiver) SeekMessageToBeginning(client *Client) bool + func (mr *MessageReceiver) SeekMessageToBody(client *Client) bool + func (mr *MessageReceiver) ToAllEmails() []AddressEmail + func (mr *MessageReceiver) ToAllEmailsAsString() []string + type MessageReceiverProxy interface + ArrivalTime func() time.Time + GetBodyOffset func() int64 + GetBuffer func() *filebuf.Buf + GetMessage func() *mail.Message + InitialMessageSize func() int + MoveBufferPosToMessageStartLine func() error + MoveBufferPosToStart func() error + type Metrics struct + func (m *Metrics) ClientConnected() int32 + func (m *Metrics) ClientDisconnected() int32 + func (m *Metrics) ConnectedClients() int32 + type PostmasterHolder interface + MailerDaemonEmailAddress func() string + type RejectBehaviour struct + Close bool + Message string + type RejectErr struct + AppendMessage string + CloseConnection bool + Code RejectErrCode + func (r RejectErr) Error() string + func (r RejectErr) ToMtpResponse() string + type RejectErrCode int + const QuotaLowRejectErr + const RecipientAddressRejectErr + const RecipientServerRejectErr + const TemporaryMailBoxProblemErr + const TemporaryServerRejectErr + const TooManyConnectionsRejectErr + const YouSpamerGoAwayRejectErr + type Session interface + AcceptMessage func(message *mail.Message) error + AcceptMessageFromEmail func(senderAscii AddressEmail) error + AcceptRecipient func(recipientAscii AddressEmail) error + Close func() + From func() AddressEmail + IsAllowSendAs func(addressEmailInAsciiLowerCase AddressEmail) (bool, error) + IsLoggedIn func() bool + MaxMessageSize func() uint64 + OnAuthorization func(username string, password string, service api.Service, useSsl api.Maybe) (bool, error) + ProcessDelivery func(proxy MessageReceiverProxy, delivery Delivery, revHostname string) error + ResetMessageReceivingStatus func() error + type State int + const StateData + const StatePassive + type Super interface + DefaultMaxMessageSizeInBytes func() int64 + DefaultMaxRecipientsPerMessage func() int + Flags func() bitmask.Flag64 + Hostname func() string + Name func() string + Version func() string + type SupervisorExt interface + CloseSession func(session Session) + OpenSession func(ci ConnectionInfo, l *slog.Logger) (session Session, err error)