config

package
v1.14.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package config handles the application configuration

Index

Constants

This section is empty.

Variables

View Source
var (
	// SMTPListen to listen on <interface>:<port>
	SMTPListen = "[::]:1025"

	// HTTPListen to listen on <interface>:<port>
	HTTPListen = "[::]:8025"

	// DataFile for mail (optional)
	DataFile string

	// MaxMessages is the maximum number of messages a mailbox can have (auto-pruned every minute)
	MaxMessages = 500

	// UseMessageDates sets the Created date using the message date, not the delivered date
	UseMessageDates bool

	// UITLSCert file
	UITLSCert string

	// UITLSKey file
	UITLSKey string

	// UIAuthFile for UI & API authentication
	UIAuthFile string

	// Webroot to define the base path for the UI and API
	Webroot = "/"

	// SMTPTLSCert file
	SMTPTLSCert string

	// SMTPTLSKey file
	SMTPTLSKey string

	// SMTPTLSRequired to enforce TLS
	// The only allowed commands are NOOP, EHLO, STARTTLS and QUIT (as specified in RFC 3207) until
	// the connection is upgraded to TLS i.e. until STARTTLS is issued.
	SMTPTLSRequired bool

	// SMTPAuthFile for SMTP authentication
	SMTPAuthFile string

	// SMTPAuthAllowInsecure allows PLAIN & LOGIN unencrypted authentication
	SMTPAuthAllowInsecure bool

	// SMTPAuthAcceptAny accepts any username/password including none
	SMTPAuthAcceptAny bool

	// SMTPMaxRecipients is the maximum number of recipients a message may have.
	// The SMTP RFC states that an server must handle a minimum of 100 recipients
	// however some servers accept more.
	SMTPMaxRecipients = 100

	// IgnoreDuplicateIDs will skip messages with the same ID
	IgnoreDuplicateIDs bool

	// DisableHTMLCheck used to disable the HTML check in bother the API and web UI
	DisableHTMLCheck = false

	// BlockRemoteCSSAndFonts used to disable remote CSS & fonts
	BlockRemoteCSSAndFonts = false

	// SMTPCLITags is used to map the CLI args
	SMTPCLITags string

	// ValidTagRegexp represents a valid tag
	ValidTagRegexp = regexp.MustCompile(`^([a-zA-Z0-9\-\ \_\.]){1,}$`)

	// SMTPTags are expressions to apply tags to new mail
	SMTPTags []AutoTag

	// SMTPRelayConfigFile to parse a yaml file and store config of relay SMTP server
	SMTPRelayConfigFile string

	// SMTPRelayConfig to parse a yaml file and store config of relay SMTP server
	SMTPRelayConfig SMTPRelayConfigStruct

	// SMTPStrictRFCHeaders will return an error if the email headers contain <CR><CR><LF> (\r\r\n)
	// @see https://github.com/axllent/mailpit/issues/87 & https://github.com/axllent/mailpit/issues/153
	SMTPStrictRFCHeaders bool

	// SMTPAllowedRecipients if set, will only accept recipients matching this regular expression
	SMTPAllowedRecipients string

	// SMTPAllowedRecipientsRegexp is the compiled version of SMTPAllowedRecipients
	SMTPAllowedRecipientsRegexp *regexp.Regexp

	// ReleaseEnabled is whether message releases are enabled, requires a valid SMTPRelayConfigFile
	ReleaseEnabled = false

	// SMTPRelayAllIncoming is whether to relay all incoming messages via pre-configured SMTP server.
	// Use with extreme caution!
	SMTPRelayAllIncoming = false

	// POP3Listen address - if set then Mailpit will start the POP3 server and listen on this address
	POP3Listen = "[::]:1110"

	// POP3AuthFile for POP3 authentication
	POP3AuthFile string

	// POP3TLSCert TLS certificate
	POP3TLSCert string

	// POP3TLSKey TLS certificate key
	POP3TLSKey string

	// EnableSpamAssassin must be either <host>:<port> or "postmark"
	EnableSpamAssassin string

	// WebhookURL for calling
	WebhookURL string

	// ContentSecurityPolicy for HTTP server - set via VerifyConfig()
	ContentSecurityPolicy string

	// AllowUntrustedTLS allows untrusted HTTPS connections link checking & screenshot generation
	AllowUntrustedTLS bool

	// Version is the default application version, updated on release
	Version = "dev"

	// Repo on Github for updater
	Repo = "axllent/mailpit"

	// RepoBinaryName on Github for updater
	RepoBinaryName = "mailpit"
)

Functions

func VerifyConfig

func VerifyConfig() error

VerifyConfig wil do some basic checking

Types

type AutoTag added in v1.6.0

type AutoTag struct {
	Tag   string
	Match string
}

AutoTag struct for auto-tagging

type SMTPRelayConfigStruct added in v1.14.4

type SMTPRelayConfigStruct struct {
	Host                    string         `yaml:"host"`
	Port                    int            `yaml:"port"`
	STARTTLS                bool           `yaml:"starttls"`
	AllowInsecure           bool           `yaml:"allow-insecure"`
	Auth                    string         `yaml:"auth"`               // none, plain, login, cram-md5
	Username                string         `yaml:"username"`           // plain & cram-md5
	Password                string         `yaml:"password"`           // plain
	Secret                  string         `yaml:"secret"`             // cram-md5
	ReturnPath              string         `yaml:"return-path"`        // allow overriding the bounce address
	AllowedRecipients       string         `yaml:"allowed-recipients"` // regex, if set needs to match for mails to be relayed
	AllowedRecipientsRegexp *regexp.Regexp // compiled regexp using AllowedRecipients
	// DEPRECATED 2024/03/12
	RecipientAllowlist string `yaml:"recipient-allowlist"`
}

SMTPRelayConfigStruct struct for parsing yaml & storing variables

Jump to

Keyboard shortcuts

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