api

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mailbox

type Mailbox struct {
	IsAlias bool

	// if alias, here is the address where to send the messages, otherwise, where to send a copy to,
	// enter email addresses separated by a comma
	TransportTo          string
	Created              time.Time
	Account              string
	EmailLowerAscii      string
	DomainLowerAscii     string
	FullNameOfEmailOwner string

	// Salted password
	Password string

	// mount point on disk e.g. /mnt/drive2
	MountPath string

	// reserved disk space for the mailbox
	Quota uint64
	// space used by the mailbox
	UsedQuota uint64

	// outgoing mail functionality for the mailbox
	SmtpOutEnabled bool
	// incoming mail functionality for the mailbox
	SmtpInEnabled bool
	// IMAP functionality for the mailbox
	ImapEnabled bool

	ImapUnsecureOff bool
	// POP3 functionality for the mailbox
	PopEnabled     bool
	PopUnsecureOff bool
	WebmailOff     bool
	ImapSharedOff  bool
	// This option is used by Courier-IMAP in calculating access control lists. This option places the account as
	// a member of access group name. Instead of granting access rights on individual mail folders to individual accounts,
	// the access rights can be granted to an access group “name”, and all members of this group get the specified access rights.
	//
	// The access group name “administrators” is a reserved group. All accounts in the administrators group automatically
	// receive all rights to all accessible folders.
	//
	//Note
	//This option may be specified multiple times to specify that the account belongs to multiple account groups.
	ImapGroup string

	// For technical reasons, group names may not include comma, tab, "/" or "|" characters.
	ImapSharedGroup string

	// a list of email addresses that are treated as trusted senders that should never fall into spam
	WhiteList []string

	// a list of email addresses that are spammers, and always mark messages from hims as spam
	BlackList []string

	// plane name
	Packet string

	// MoveSpam
	// if true: when incoming mail is recognized as unwanted, add the SPAM prefix to the subject
	// and leave it in the current folder
	// if false:  when incoming mail is recognized as unwanted move to Spam folder
	MoveToSpam bool

	SysUid uint
	SysGid uint

	// Disabled true if you do not want to currently handle the mailbox
	Disabled bool
	// AccountDisabled  true if you do not want to currently handle any mailbox from this Account
	AccountDisabled bool

	// AutoresponderEnabled send an automatic reply to every new incoming message that is classified as wanted
	AutoresponderEnabled bool
	// AutoresponderSubject subject of autoresponder message
	// insert %t% anywhere in the string to paste the message title you are replying to, e.g.:
	// Re: %t%
	AutoresponderSubject string
	// AutoresponderBody plain text of autoresponder body
	AutoresponderBody string

	// Incoming mail host address, or where to route messages to servers
	SmtpInHost string

	// For logging for clients, for NGINX Proxy,
	// info where to direct proxy people for clients for imap and pop, addressIp
	SmtpOutHost string
	SmtpOutIp   string

	ImapIp string

	// 04.10.23
	// The IMAP server checks if it matches its hostname
	// otherwise it does not allow you to store or receive messages,
	// must be same as hostname of supervisor, because the configuration base on all hosts is the same,
	// and the supervisor himself decides which mailboxes to support
	ImapHostname string `json:"imaphn"`
	// The SMTP server that is responsible for sending the message,
	// checks if it matches its Hostname and then allows you to send the message from itself,
	// if SmptOutHostname agrees and ImapHostname is different,
	// then we redirect lmtp to ImapHostname for stored messages, then it must replace SmtpOutHost and SmtpOutIp
	SmtpOutHostname string `json:"smtpouthn"`

	// The host that is responsible for the storage
	ImapHost string

	// ImapStoreLmtp where we store messages after receiving
	// 0 or empty is the default value - so it's like using maildir on postfix
	// jeżeli nie jest puste:
	//		-  if there is a SmtpInHost, then compare SmtpInHost is equal to the host of your system
	//		and if so deliver locally - otherwise pass it on via lmtp:{sourceFrom_ImapLmtp}
	ImapStoreLmtp string

	// do not limit the number of messages sent from this mail
	UnlimitedOutgoingSmtp bool `json:"ulimitsmtp"`

	// todo internal use in our company, remove from the code
	PrivatePortSfx string `json:"ppsfx"`
}

Mailbox todoThe structure of Mailbox needs to be reduced, as it contains parts of the code used inside our company, which will not be published here

type MaildirStorage added in v0.0.2

type MaildirStorage interface {
	// GenerateNextSpooledMessageName Generate a new email ID to be stored in spool
	GenerateNextSpooledMessageName() string

	// GetAbsoluteMaildirPath build maildir path prefix
	GetAbsoluteMaildirPath(mb *Mailbox) string

	// AbsoluteSpoolPath absolute path, pointing to the directory where messages queued
	// for sending to MailSenderNode() are stored. Important, check that it is not empty
	AbsoluteSpoolPath() string
}

type MaildirSupervisor added in v0.0.2

type MaildirSupervisor interface {
	MaildirStorage
	Supervisor
}

MaildirSupervisor is a Supervisor with mail storage support

type Maybe

type Maybe int

Maybe Extended bool

const (
	No Maybe = iota
	Yes
	// DontKnow W chwili obecnej nie jestem tego w stanie sprawdzić
	DontKnow
)

func Answer

func Answer(val bool) Maybe

func (Maybe) False

func (b Maybe) False() bool

func (Maybe) HaveAnswer

func (m Maybe) HaveAnswer() bool

HaveAnswer Do you know the answer?

func (Maybe) String

func (b Maybe) String() string

String for test purposes

func (Maybe) ToBool

func (b Maybe) ToBool() bool

func (Maybe) True

func (b Maybe) True() bool

type Service

type Service int
const (
	UnknownService Service = iota
	SmtpInService
	SmtpOutService
	ImapService
	PopService
	Kwark
)

type Supervisor

type Supervisor interface {
	// Hostname of your node, this name must coincide with the value of Mailbox.ImapHostname,
	// if it is different, we will not accept messages e.g. via LMTP,
	// because it means that it is intended for another node and this should be directed
	// to the appropriate LMTP at the Postfix level
	Hostname() string

	// MailerDaemonEmailAddress returns what the MAILER_DAEMON address is,
	// i.e. in the case of empty email addresses sent by Postfix,
	// it must be written in lowercase and in ASCII format during the returns
	MailerDaemonEmailAddress() string

	// Authorization return immutable mailbox struct if it is enabled
	// @service which login service
	// @useSsl whether the client is using an SSL connection
	Authorization(username string, password string, service Service, useSsl Maybe) *Mailbox

	// FindMailbox return immutable mailbox struct or nil, don't check it is enabled
	FindMailbox(name string) *Mailbox

	// IsLocalDomain Is the indicated domain in our resources? More specifically,
	// whether we host at least one mailbox on this domain
	//
	// @return if you have problems with the database (e.g. no connection)
	// or you suspect that your configurations are out of sync, return Maybe.DontKnow,
	// this will cause us to ask the sender to resend the shipment at a later date
	IsLocalDomain(asciiDomainNameLowerCase string) Maybe

	// IsLocalEmail Is the email address local, do not check other things,
	// the question is only whether this address is supported by our server
	//
	// @return if you have problems with the database (e.g. no connection)
	// or you suspect that your configurations are out of sync, return Maybe.DontKnow,
	// this will cause us to ask the sender to resend the shipment at a later date
	IsLocalEmail(emailAsciiLowerCase string) Maybe

	// MainSenderNode main host and port of zoha-sender-server
	// the host must be accessible from each ZOHA-LMTP instance, so it must be a public or tunneled host
	// ZohaSenderClient uses MainSenderNode as an intermediary node to send messages directed to aliases
	// or in the case of an autoresponder
	MainSenderNode() string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL