core

package
v0.0.0-...-2dc86d1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2017 License: MIT Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CR is a Carriage Return
	CR = 13
	// LF is a Line Feed
	LF = 10
)
View Source
const (
	// Time822 formt time for RFC 822
	Time822 = "02 Jan 2006 15:04:05 -0700" // "02 Jan 06 15:04 -0700"
)

Variables

View Source
var (
	// Version is tamil version
	Version string
	Cfg     *Config
	DB      *gorm.DB
	Bolt    *bolt.DB
	//Log                              *Logger
	Logger                           *logrus.Logger
	NsqQueueProducer                 *nsq.Producer
	SmtpSessionsCount                int
	ChSmtpSessionsCount              chan int
	DeliverdConcurrencyLocalCount    int
	DeliverdConcurrencyRemoteCount   int
	ChDeliverdConcurrencyRemoteCount chan int
	Store                            Storer
)
View Source
var DeliverdPlugins map[string][]DeliverdPlugin

DeliverdPlugins map of deliverd plugins

View Source
var (
	// ErrNonAsciiCharDetected when an email body does not contain only 7 bits ascii char
	ErrNonAsciiCharDetected = errors.New("email must contains only 7-bit ASCII characters")
)
View Source
var SMTPdPlugins map[string][]SMTPdPlugin

SMTPdPlugins is a map of SMTPd plugins

View Source
var TmailPlugins map[string][]TmailPlugin

TmailPlugins is a map of plugin

Functions

func AddRoute

func AddRoute(host, localIp, remoteHost string, remotePort, priority int, user, mailFrom, smtpAuthLogin, smtpAuthPasswd string) error

AddRoute add a new route

func AliasAdd

func AliasAdd(alias, deliverTo, pipe string, isMiniList bool) error

AliasAdd create a new tmail alias

func AliasDel

func AliasDel(alias string) error

AliasDel is used to delete an alias

func AliasExists

func AliasExists(alias string) (bool, error)

AliasExists checks if an alias exists

func AutoMigrateDB

func AutoMigrateDB(DB *gorm.DB) error

AutoMigrateDB will keep tables reflecting structs

func Bootstrap

func Bootstrap() (err error)

Bootstrap DB, config,... TODO check validity of each element

func DelRoute

func DelRoute(id int64) error

DelRoute delete a route

func DkimDisable

func DkimDisable(domain string) error

DkimDisable Disable DKIM for domain domain by removing his DkimConfig entry

func ErrBadDsn

func ErrBadDsn(err error) error

ErrBadDsn when dsn is wrong

func GetBasePath

func GetBasePath() string

GetDistPath returns basePath (where tmail binaries is)

func GetDsnsFromString

func GetDsnsFromString(dsnsStr string) (dsns []dsn, err error)

getDsnsFromString Get dsn string from config and returns slice of dsn struct

func InitBolt

func InitBolt() error

InitBolt init bolt

func InitDB

func InitDB(DB *gorm.DB) error

InitDB create tables if needed and initialize them TODO: SKIP in CLI TODO: check regularly structure & indexes

func IpCanRelay

func IpCanRelay(ip net.Addr) (bool, error)

remoteIpCanUseSmtp checks if an IP can relay

func IsIPV4

func IsIPV4(ip string) bool

IsIPV4 return true if ip is ipV4 todo: refactor

func IsInRcptHost

func IsInRcptHost(hostname string) (bool, error)

IsInRcptHost checks if domain is in the RcptHost list (-> relay authorized)

func IsOkDB

func IsOkDB(DB *gorm.DB) bool

IsOkDB checks if database is ok

func IsStringInSlice

func IsStringInSlice(str string, s []string) (found bool)

Check if a string is in a Slice of string TODO: replace by sort package

func IsValidLocalRcpt

func IsValidLocalRcpt(rcpt string) (bool, error)

IsValidLocalRcpt checks if rcpt is a valid local destination Mailbox (or wildcard) Alias catchall

func LaunchDeliverd

func LaunchDeliverd()

LaunchDeliverd launch deliverd

func MailboxAdd

func MailboxAdd(mailbox string) error

MailboxAdd adds a new mailbox

func MailboxDel

func MailboxDel(mailbox string) error

MailboxDel delete Mailbox TODO: supprimer tout ce qui est associé a cette boite

func MailboxExists

func MailboxExists(mailbox string) (bool, error)

MailboxExists checks if mailbox exist

func NewClamav

func NewClamav() *clamav

NewClamav returns a new clamac wrapper

func NewDiskStore

func NewDiskStore() (*diskStore, error)

NewDiskStore returns a store with local disk as backend

func NewUUID

func NewUUID() (string, error)

newUUID generates a random UUID according to RFC 4122

func QueueAddMessage

func QueueAddMessage(rawMess *[]byte, envelope message.Envelope, authUser string) (uuid string, err error)

QueueAddMessage add a new mail in queue

func QueueCount

func QueueCount() (c uint32, err error)

QueueCount rerurn the number of message in queue

func RcpthostAdd

func RcpthostAdd(hostname string, isLocal, isAlias bool) error

RcpthostAdd add hostname to rcpthosts

func RcpthostDel

func RcpthostDel(hostname string) error

RcpthostDel delete a hostname from rcpthosts list

func RegisterDeliverdPlugin

func RegisterDeliverdPlugin(hook string, plugin DeliverdPlugin)

RegisterDeliverdPlugin registers plugin for deliverd hooks

func RegisterPlugin

func RegisterPlugin(hook string, plugin TmailPlugin)

RegisterPlugin registers a new plugin

func RegisterSMTPdPlugin

func RegisterSMTPdPlugin(hook string, plugin SMTPdPlugin)

RegisterSMTPdPlugin registers a new smtpd plugin

func RelayIpAdd

func RelayIpAdd(ip string) error

 relayipAdd authorize IP to relay through tmail

func RelayIpDel

func RelayIpDel(ip string) error

RelayIpDel remove ip from authorized IP

func RemoveBrackets

func RemoveBrackets(s string) string

RemoveBrackets removes trailing and ending brackets (<string> -> string)

func StripQuotes

func StripQuotes(s string) string

StripQuotes remove trailing and ending "

func Unix2dos

func Unix2dos(ch *[]byte) (err error)

Unix2dos replace all line ending from \n to \r\n

func UserAdd

func UserAdd(login, passwd, mbQuota string, haveMailbox, authRelay, isCatchall bool) error

UserAdd add an user

func UserChangePassword

func UserChangePassword(login, password string) error

UserChangePassword is used to change user password

func UserDel

func UserDel(login string) error

UserDel delete an user

func UserExists

func UserExists(login string) (bool, error)

UserExists checks if an user exists

Types

type Alias

type Alias struct {
	ID         int64
	Alias      string `sql:"unique"`
	DeliverTo  string `sql:"null"`
	Pipe       string `sql:"null"`
	IsDomAlias bool   `sql:"default:false"`
	IsMiniList bool   `sql:"default:false"`
}

Alias represents a tmail alias

func AliasGet

func AliasGet(aliasStr string) (alias Alias, err error)

AliasGet returns an alias

func AliasList

func AliasList() (aliases []Alias, err error)

AliasList return all alias

type Config

type Config struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Config represents tmail confiig when default is set to _ that means that the defauly value is (type)null (eg "" for string)

func InitConfig

func InitConfig(prefix string) (*Config, error)

InitConfig initialise config

func (*Config) GetBoltFile

func (c *Config) GetBoltFile() string

GetBoltFile return BoltFile

func (*Config) GetClusterModeEnabled

func (c *Config) GetClusterModeEnabled() bool

GetClusterModeEnabled return clusterModeEnabled

func (*Config) GetDbDriver

func (c *Config) GetDbDriver() string

GetDbDriver returns database driver

func (*Config) GetDbSource

func (c *Config) GetDbSource() string

GetDbSource return database source

func (*Config) GetDebugEnabled

func (c *Config) GetDebugEnabled() bool

GetDebugEnabled returns debugEnabled

func (*Config) GetDeliverdConcurrencyLocal

func (c *Config) GetDeliverdConcurrencyLocal() int

GetDeliverdMaxInFlight returns DeliverdMaxInFlight

func (*Config) GetDeliverdConcurrencyRemote

func (c *Config) GetDeliverdConcurrencyRemote() int

GetDeliverdConcurrencyRemote returns max concurrency for deliverd remote

func (*Config) GetDeliverdDkimSign

func (c *Config) GetDeliverdDkimSign() bool

GetDeliverdDkimSign wheras deliverd must sign outgoing (remote) email

func (*Config) GetDeliverdQueueBouncesLifetime

func (c *Config) GetDeliverdQueueBouncesLifetime() int

GetDeliverdQueueBouncesLifetime return DeliverdQueueBouncesLifetime

func (*Config) GetDeliverdQueueLifetime

func (c *Config) GetDeliverdQueueLifetime() int

GetDeliverdQueueLifetime return queue lifetime in minutes

func (*Config) GetDeliverdRemoteTLSFallback

func (c *Config) GetDeliverdRemoteTLSFallback() bool

GetDeliverdRemoteTLSFallback return DeliverdRemoteTLSFallback

func (*Config) GetDeliverdRemoteTLSSkipVerify

func (c *Config) GetDeliverdRemoteTLSSkipVerify() bool

GetDeliverdRemoteTLSSkipVerify return DeliverdRemoteTLSSkipVerify

func (*Config) GetDeliverdRemoteTimeout

func (c *Config) GetDeliverdRemoteTimeout() int

GetDeliverdRemoteTimeout return remote timeout in second time to wait for a response from remote server before closing conn

func (*Config) GetDovecotLda

func (c *Config) GetDovecotLda() string

GetDovecotLda returns path to dovecot-lda binary

func (*Config) GetDovecotSupportEnabled

func (c *Config) GetDovecotSupportEnabled() bool

GetDovecotSupportEnabled returns DovecotSupportEnabled

func (*Config) GetHideServerSignature

func (c *Config) GetHideServerSignature() bool

GetHideServerSignature HideServerSignature

func (*Config) GetLaunchDeliverd

func (c *Config) GetLaunchDeliverd() bool

GetLaunchDeliverd returns true if deliverd have to be launched

func (*Config) GetLaunchSmtpd

func (c *Config) GetLaunchSmtpd() bool

GetLaunchSmtpd returns true if smtpd have to be launched

func (*Config) GetLocalIps

func (c *Config) GetLocalIps() string

GetLocalIps returns ordered lits of local IP (net.IP) to use when sending mail

func (*Config) GetLogPath

func (c *Config) GetLogPath() string

GetLogPath return log path

func (*Config) GetMe

func (c *Config) GetMe() string

GetMe return me

func (*Config) GetMicroservicesUri

func (c *Config) GetMicroservicesUri(hookId string) []string

GetMicroservicesUri returns defined URI for a hookId

func (*Config) GetNSQLookupdHttpAddresses

func (c *Config) GetNSQLookupdHttpAddresses() (addr []string)

GetNSQLookupdHttpAddresses returns lookupd HTTP adresses

func (*Config) GetNSQLookupdTcpAddresses

func (c *Config) GetNSQLookupdTcpAddresses() (addr []string)

GetNSQLookupdTcpAddresses returns lookupd tcp adresses

func (*Config) GetOpenstackEnable

func (c *Config) GetOpenstackEnable() bool

GetOpenstackEnable returns if openstack support is enabled

func (*Config) GetRestServerIp

func (c *Config) GetRestServerIp() string

GetRestServerIp return the ip that the REST server should listen on

func (*Config) GetRestServerIsTls

func (c *Config) GetRestServerIsTls() bool

GetRestServerIsTls return RestServerIsTls

func (*Config) GetRestServerLaunch

func (c *Config) GetRestServerLaunch() bool

GetRestServerLaunch return true if REST server must be launched

func (*Config) GetRestServerLogin

func (c *Config) GetRestServerLogin() string

GetRestServerLogin return RestServerLogin

func (*Config) GetRestServerPasswd

func (c *Config) GetRestServerPasswd() string

GetRestServerPasswd return RestServerPasswd

func (*Config) GetRestServerPort

func (c *Config) GetRestServerPort() int

GetRestServerPort return the port that the REST server should listen on

func (*Config) GetSmtpdClamavDsns

func (c *Config) GetSmtpdClamavDsns() string

GetSmtpdClamavDsns returns clamav dsns

func (*Config) GetSmtpdClamavEnabled

func (c *Config) GetSmtpdClamavEnabled() bool

GetSmtpdClamavEnabled returns if clamav scan is enable

func (*Config) GetSmtpdConcurrencyIncoming

func (c *Config) GetSmtpdConcurrencyIncoming() int

GetSmtpdConcurrencyIncoming returns ConcurrencyIncoming

func (*Config) GetSmtpdDsns

func (c *Config) GetSmtpdDsns() string

GetSmtpdDsns returns smtpd dsns

func (*Config) GetSmtpdMaxBadRcptTo

func (c *Config) GetSmtpdMaxBadRcptTo() int

GetSmtpdMaxBadRcptTo returns the maximum number of bad RCPT TO commands

func (*Config) GetSmtpdMaxDataBytes

func (c *Config) GetSmtpdMaxDataBytes() int

GetSmtpdMaxDataBytes returns max size of accepted email

func (*Config) GetSmtpdMaxHops

func (c *Config) GetSmtpdMaxHops() int

GetSmtpdMaxHops returns the number of relay a mail can traverser

func (*Config) GetSmtpdMaxRcptTo

func (c *Config) GetSmtpdMaxRcptTo() int

GetSmtpdMaxRcptTo returns the maximum number of RCPT TO commands

func (*Config) GetSmtpdMaxVrfy

func (c *Config) GetSmtpdMaxVrfy() int

GetSmtpdMaxVrfy return GetSmtpdMaxVrfy

func (*Config) GetSmtpdServerTimeout

func (c *Config) GetSmtpdServerTimeout() int

GetSmtpdTransactionTimeout return smtpdTransactionTimeout

func (*Config) GetStoreDriver

func (c *Config) GetStoreDriver() string

GetStoreDriver return source driver disk runabove

func (*Config) GetStoreSource

func (c *Config) GetStoreSource() string

GetStoreSource return store source

func (*Config) GetTempDir

func (c *Config) GetTempDir() string

GetTempDir return temp directory

func (*Config) GetUserMailboxDefaultQuota

func (c *Config) GetUserMailboxDefaultQuota() string

func GetUserMailboxDefaultQuota return the default mailbox quota

func (*Config) GetUsersHomeBase

func (c *Config) GetUsersHomeBase() string

GetUsersHomeBase returns users home base

func (*Config) SetRestServerLogin

func (c *Config) SetRestServerLogin(login string)

SetRestServerLogin is used to set REST server login

func (*Config) SetRestServerPasswd

func (c *Config) SetRestServerPasswd(passwd string)

SetRestServerPasswd set RestServerPasswd

type DeliverdAuth

type DeliverdAuth interface {
	// Start begins an authentication with a server.
	// It returns the name of the authentication protocol
	// and optionally data to include in the initial AUTH message
	// sent to the server. It can return proto == "" to indicate
	// that the authentication should be skipped.
	// If it returns a non-nil error, the SMTP client aborts
	// the authentication attempt and closes the connection.
	Start(server *ServerInfo) (proto string, toServer []byte, err error)

	// Next continues the authentication. The server has just sent
	// the fromServer data. If more is true, the server expects a
	// response, which Next should return as toServer; otherwise
	// Next should return toServer == nil.
	// If Next returns a non-nil error, the SMTP client aborts
	// the authentication attempt and closes the connection.
	Next(fromServer []byte, more bool) (toServer []byte, err error)
}

Auth is implemented by an SMTP authentication mechanism.

func CRAMMD5Auth

func CRAMMD5Auth(username, secret string) DeliverdAuth

CRAMMD5Auth returns an Auth that implements the CRAM-MD5 authentication mechanism as defined in RFC 2195. The returned Auth uses the given username and secret to authenticate to the server using the challenge-response mechanism.

func PlainAuth

func PlainAuth(identity, username, password, host string) DeliverdAuth

PlainAuth returns an Auth that implements the PLAIN authentication mechanism as defined in RFC 4616. The returned Auth uses the given username and password to authenticate on TLS connections to host and act as identity. Usually identity will be left blank to act as username.

type DeliverdPlugin

type DeliverdPlugin func(d *Delivery) bool

DeliverdPlugin type for deliverd plugin

type Delivery

type Delivery struct {
	ID                     string
	NSQMsg                 *nsq.Message
	QMsg                   *QMessage
	RawData                *[]byte
	QStore                 Storer
	StartAt                time.Time
	IsLocal                bool
	LocalAddr              string
	RemoteRoutes           []Route
	RemoteAddr             string
	RemoteSMTPresponseCode int
	Success                bool
}

Delivery is a deliver process

type DkimConfig

type DkimConfig struct {
	Id       int64
	Domain   string
	PubKey   string `sql:"type:text;"`
	PrivKey  string `sql:"type:text;"`
	Selector string
	Headers  string
}

DkimConfig represents DKIM configuration for a domain

func DkimEnable

func DkimEnable(domain string) (dkc *DkimConfig, err error)

DkimEnable enabled DKIM on domain

func DkimGetConfig

func DkimGetConfig(domain string) (dkc *DkimConfig, err error)

DkimGetConfig returns DKIM config for domain domain

type FileFormatter

type FileFormatter struct {
	// Set to true to bypass checking for a TTY before outputting colors.
	ForceColors bool

	// Force disabling colors.
	DisableColors bool

	// Disable timestamp logging. useful when output is redirected to logging
	// system that already adds timestamps.
	DisableTimestamp bool

	// Enable logging the full timestamp when a TTY is attached instead of just
	// the time passed since beginning of execution.
	FullTimestamp bool

	// TimestampFormat to use for display when a full timestamp is printed
	TimestampFormat string

	// The fields are sorted by default for a consistent output. For applications
	// that log extremely frequently and don't use the JSON formatter this may not
	// be desired.
	DisableSorting bool
}

func (*FileFormatter) Format

func (f *FileFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format formats the log entry

type Mailbox

type Mailbox struct {
	Id         int64
	LocalPart  string
	DomainPart string
}

func MailboxList

func MailboxList() (mailboxes []Mailbox, err error)

MailboxList return all mailboxes

func (*Mailbox) Put

func (m *Mailbox) Put()

type NSQLogger

type NSQLogger struct{}

NSQLogger is a logger for Nsq

func NewNSQLogger

func NewNSQLogger() *NSQLogger

NewNSQLogger return a new NSQLogger

func (*NSQLogger) Output

func (n *NSQLogger) Output(calldepth int, s string) error

Output implements nsq.logger.Output interface

type QMessage

type QMessage struct {
	sync.Mutex
	Id                      int64
	Uuid                    string // Unique ID common to all QMessage, representing the queued ID of the message
	MailFrom                string
	AuthUser                string // Si il y a eu authentification SMTP contient le login/user sert pour le routage
	RcptTo                  string
	MessageId               string
	Host                    string
	LastUpdate              time.Time
	AddedAt                 time.Time
	NextDeliveryScheduledAt time.Time
	Status                  uint32 // 0 delivery in progress, 1 to be discarded, 2 scheduled, 3 to be bounced
	DeliveryFailedCount     uint32
}

QMessage represents a message in queue

func QueueGetExpiredMessages

func QueueGetExpiredMessages() (messages []QMessage, err error)

QueueGetExpiredMessages return expired messages from DB

func QueueGetMessageById

func QueueGetMessageById(id int64) (msg QMessage, err error)

QueueGetMessageById return a message from is key

func QueueListMessages

func QueueListMessages() ([]QMessage, error)

QueueListMessages return all messages in queue

func (*QMessage) Bounce

func (q *QMessage) Bounce() error

Bounce mark message as being bounced on next delivery attemp

func (*QMessage) Delete

func (q *QMessage) Delete() error

Delete delete message from queue

func (*QMessage) Discard

func (q *QMessage) Discard() error

Discard mark message as being discarded on next delivery attemp

func (*QMessage) SaveInDb

func (q *QMessage) SaveInDb() error

SaveInDb save qMessage in DB

func (*QMessage) UpdateFromDb

func (q *QMessage) UpdateFromDb() error

UpdateFromDb update message from DB

type RcptHost

type RcptHost struct {
	Id       int64
	Hostname string `sql:"unique"`
	IsLocal  bool   `sql:"default:false"`
	IsAlias  bool   `sql:"default:false"`
}

RcptHost represents a hostname that tmail have to handle mails for (=local domains)

func RcpthostGet

func RcpthostGet(hostname string) (rcpthost RcptHost, err error)

RcpthostGet return a rcpthost

func RcpthostGetAll

func RcpthostGetAll() (hostnames []RcptHost, err error)

RcpthostGetAll return hostnames in rcpthosts

type RelayIpOk

type RelayIpOk struct {
	Id int64
	Ip string `sql:"unique"`
}

relayOkIp represents an IP that can use SMTP for relaying

func RelayIpGetAll

func RelayIpGetAll() (ips []RelayIpOk, err error)

RelayIpList return all IPs authorized to relay through tmail

type Route

type Route struct {
	Id             int64
	Host           string `sql:not null` // destination
	LocalIp        sql.NullString
	RemoteHost     string `sql:not null`
	RemotePort     sql.NullInt64
	Priority       sql.NullInt64
	SmtpAuthLogin  sql.NullString
	SmtpAuthPasswd sql.NullString
	MailFrom       sql.NullString
	User           sql.NullString
}

Route represents a route in DB

func GetAllRoutes

func GetAllRoutes() (routes []Route, err error)

GetAllRoutes returns all routes (really ?!)

type SMTPServerSession

type SMTPServerSession struct {
	Conn net.Conn

	RelayGranted bool

	Envelope   message.Envelope
	LastRcptTo string

	BadRcptToCount int

	SMTPResponseCode uint32

	CurrentRawMail []byte
	// contains filtered or unexported fields
}

SMTPServerSession retpresents a SMTP session (server)

func NewSMTPServerSession

func NewSMTPServerSession(conn net.Conn, isTLS bool) (sss *SMTPServerSession, err error)

NewSMTPServerSession returns a new SMTP session

func (*SMTPServerSession) ExitAsap

func (s *SMTPServerSession) ExitAsap()

ExitAsap exist session as soon as possible

func (*SMTPServerSession) GetEnvelope

func (s *SMTPServerSession) GetEnvelope() *message.Envelope

GetEnvelope returns pointer to current envelope mainly used for plugin

func (*SMTPServerSession) GetLastClientCmd

func (s *SMTPServerSession) GetLastClientCmd() []byte

GetLastClientCmd returns lastClientCmd (not splited)

func (*SMTPServerSession) Log

func (s *SMTPServerSession) Log(msg ...string)

Log helper for INFO log

func (*SMTPServerSession) LogDebug

func (s *SMTPServerSession) LogDebug(msg ...string)

LogDebug is a log helper for DEBUG logs

func (*SMTPServerSession) LogError

func (s *SMTPServerSession) LogError(msg ...string)

LogError is a log helper for ERROR logs

func (*SMTPServerSession) Out

func (s *SMTPServerSession) Out(msg string)

Out : to client

func (*SMTPServerSession) Reset

func (s *SMTPServerSession) Reset()

Reset session

type SMTPdPlugin

type SMTPdPlugin func(s *SMTPServerSession) bool

SMTPdPlugin is the type for SMTPd plugins

type ServerInfo

type ServerInfo struct {
	//Address net.TCPAddr // SMTP adrress
	Name string   // SMTP server name
	TLS  bool     // using TLS, with valid certificate for Name
	Auth []string // advertised authentication mechanisms
}

ServerInfo records information about an SMTP server.

type Smtpd

type Smtpd struct {
	// contains filtered or unexported fields
}

Smtpd SMTP Server

func NewSmtpd

func NewSmtpd(d dsn) *Smtpd

NewSmtpd returns a new SmtpServer

func (*Smtpd) ListenAndServe

func (s *Smtpd) ListenAndServe()

ListenAndServe launch server

type Storer

type Storer interface {
	//TODO should return perm or temp failure
	Get(key string) (io.Reader, error)
	Put(key string, reader io.Reader) error
	Del(key string) error
}

Storer is a interface for stores

func NewStore

func NewStore(driver, source string) (Storer, error)

NewStore return a new srore

type TmailPlugin

type TmailPlugin func()

TmailPlugin base plugin for hooks: - postinit

type User

type User struct {
	Id           int64
	Login        string `sql:"unique"`
	Passwd       string `sql:"not null"`
	DovePasswd   string `sql:"null"`                     // SHA512 passwd workaround (glibc on most linux flavor doesn't have bcrypt support)
	Active       string `sql:"type:char(1);default:'Y'"` //rune `sql:"type:char(1);not null;default:'Y'`
	AuthRelay    bool   `sql:"default:false"`            // authorization of relaying
	HaveMailbox  bool   `sql:"default:false"`
	IsCatchall   bool   `sql:"default:false"`
	MailboxQuota string `sql:"null"`
	Home         string `sql:"null"` // used by dovecot to store mailbox
}

User represents a tmail user.

func UserGet

func UserGet(login, passwd string) (user *User, err error)

UserGet return an user by is login/passwd

func UserGetByLogin

func UserGetByLogin(login string) (user *User, err error)

UserGetByLogin return an user from his login

func UserGetCatchallForDomain

func UserGetCatchallForDomain(domain string) (user *User, err error)

UserGetCatchallForDomain return catchall

func UserList

func UserList() (users []User, err error)

UserList return all user

func (*User) ChangePasswd

func (u *User) ChangePasswd(passwd string) error

ChangePasswd is used to change user password

Jump to

Keyboard shortcuts

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