model

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// QueueDb queue db connection
	QueueDb *xorm.Engine
	// StatusDb status db connection
	StatusDb *xorm.Engine
)
View Source
var Config struct {
	QueueDbDialect        string   `toml:"QueueDbDialect"`
	QueueDbConnect        string   `toml:"QueueDbConnect"`
	StatusDbDialect       string   `toml:"StatusDbDialect"`
	StatusDbConnect       string   `toml:"StatusDbConnect"`
	Hostname              string   `toml:"Hostname"`
	AllowIP               []string `toml:"AllowIP"`
	AllowDomains          []string `toml:"AllowDomains"`
	SMTPListenAddr        string   `toml:"SMTPListenAddr"`
	MaxRepeatSend         uint     `toml:"MaxRepeatSend"`
	RepeatIntervalMinutes uint     `toml:"RepeatIntervalMinutes"`
	SendStream            uint     `toml:"SendStream"`
	ResendStream          uint     `toml:"ResendStream"`
	Debug                 bool     `toml:"Debug"`
}

Config application config

Functions

func AddToQueue

func AddToQueue(messageType, messageID string, from smtpd.MailAddress, rcpts []smtpd.MailAddress, data []byte) error

AddToQueue add email to queue

func CheckAllow

func CheckAllow(ip, domain string) bool

CheckAllow check right for IP and sender email domain

func OpenQueueDb

func OpenQueueDb() (err error)

OpenQueueDb open queue database

func OpenStatusDb

func OpenStatusDb() (err error)

OpenStatusDb open status database

func SetStatus

func SetStatus(email *Queue)

SetStatus set email send status

Types

type Queue

type Queue struct {
	ID           uint64    `xorm:"serial pk autoincr 'id'"`
	CreatedAt    time.Time `xorm:"created"`
	UpdatedAt    time.Time `xorm:"updated"`
	MessageType  string
	MessageID    string `xorm:"'message_id'"`
	From         string
	FromHostname string
	Rcpt         string
	RcptHostname string
	Data         string `xorm:"LONGTEXT 'data'"`
	Repeat       uint
	LaterStatus  string `xorm:"MEDIUMTEXT 'later_status'"`
}

Queue queue email model

func GetNewQueue

func GetNewQueue(limit uint) []Queue

GetNewQueue get `limit` number new emails

func GetRepeatQueue

func GetRepeatQueue(limit uint) []Queue

GetRepeatQueue get `limit` number emails for resend

Jump to

Keyboard shortcuts

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