Documentation
¶
Overview ¶
Package config handles the application configuration
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Version is the Mailpit version, updated with every release Version = "dev" // GHRUConfig is the configuration for the GitHub Release Updater // used to check for updates and self-update GHRUConfig = ghru.Config{ Repo: "axllent/mailpit", ArchiveName: "mailpit-{{.OS}}-{{.Arch}}", BinaryName: "mailpit", CurrentVersion: Version, } // SMTPListen to listen on <interface>:<port> SMTPListen = "[::]:1025" // HTTPListen to listen on <interface>:<port> HTTPListen = "[::]:8025" // Database for mail (optional) Database string // DisableWAL will disable Write-Ahead Logging in SQLite // @see https://sqlite.org/wal.html DisableWAL bool // Compression is the compression level used to store raw messages in the database: // 0 = off, 1 = fastest (default), 2 = standard, 3 = best compression Compression = 1 // TenantID is an optional prefix to be applied to all database tables, // allowing multiple isolated instances of Mailpit to share a database. TenantID string // Label to identify this Mailpit instance (optional). // This gets applied to web UI, SMTP and optional POP3 server. Label string // MaxMessages is the maximum number of messages a mailbox can have (auto-pruned every minute) MaxMessages = 500 // MaxAge is the maximum age of messages (auto-pruned every hour). // Value can be either <int>h for hours or <int>d for days MaxAge string // MaxAgeInHours is the maximum age of messages in hours, set with parseMaxAge() using MaxAge value MaxAgeInHours int // 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 = "/" // DisableHTTPCompression will explicitly disable HTTP compression in the web UI and API DisableHTTPCompression bool // SendAPIAuthFile for Send API authentication SendAPIAuthFile string // SendAPIAuthAcceptAny accepts any username/password for the send API endpoint, including none SendAPIAuthAcceptAny bool // SMTPTLSCert file SMTPTLSCert string // SMTPTLSKey file SMTPTLSKey string // SMTPRequireSTARTTLS to enforce the use of STARTTLS // 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. SMTPRequireSTARTTLS bool // SMTPRequireTLS to allow only SSL/TLS connections for all connections // SMTPRequireTLS 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 // BlockRemoteCSSAndFonts used to disable remote CSS & fonts BlockRemoteCSSAndFonts = false // AllowInternalHTTPRequests will allow HTTP requests to internal IP addresses (e.g., loopback, private, link-local, or multicast) when set to true. // This policy applies to both link checking and screenshot generation (proxy) features and is disabled by default for security reasons. AllowInternalHTTPRequests = false // CLITagsArg is used to map the CLI args CLITagsArg string // ValidTagRegexp represents a valid tag ValidTagRegexp = regexp.MustCompile(`^([a-zA-Z0-9\-\ \_\.@]){1,100}$`) // TagsConfig is a yaml file to pre-load tags TagsConfig string // TagFilters are used to apply tags to new mail TagFilters []autoTag // TagsDisable accepts a comma-separated list of tag types to disable // including x-tags & plus-addresses TagsDisable string // TagsUsername enables auto-tagging messages with the authenticated username TagsUsername bool // SMTPRelayConfigFile to parse a yaml file and store config of the relay SMTP server SMTPRelayConfigFile string // SMTPRelayConfig to parse a yaml file and store config of the the relay SMTP server SMTPRelayConfig SMTPRelayConfigStruct // ReleaseEnabled is whether message releases are enabled, requires a valid SMTPRelayConfigFile ReleaseEnabled = false // SMTPRelayAll is whether to relay all incoming messages via pre-configured SMTP server. // Use with extreme caution! SMTPRelayAll = false // SMTPRelayMatching if set, will auto-release to recipients matching this regular expression SMTPRelayMatching string // SMTPRelayMatchingRegexp is the compiled version of SMTPRelayMatching SMTPRelayMatchingRegexp *regexp.Regexp // SMTPForwardConfigFile to parse a yaml file and store config of the forwarding SMTP server SMTPForwardConfigFile string // SMTPForwardConfig to parse a yaml file and store config of the forwarding SMTP server SMTPForwardConfig SMTPForwardConfigStruct // 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 // SMTPIgnoreRejectedRecipients if true, will accept emails to rejected recipients with 2xx response but silently drop them SMTPIgnoreRejectedRecipients bool // 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 // HideDeleteAllButton hides the delete all button in the web UI HideDeleteAllButton bool // 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 // PrometheusListen address for Prometheus metrics server // Empty = disabled, true= use existing web server, address = separate server PrometheusListen string // ChaosTriggers are parsed and set in the chaos module ChaosTriggers string // DisableHTMLCheck DEPRECATED 2024/04/13 - kept here to display console warning only DisableHTMLCheck = false // DisableVersionCheck disables version checking DisableVersionCheck bool // DemoMode disables SMTP relay, link checking & HTTP send functionality DemoMode = false )
View Source
var ( // TagsDisablePlus disables message tagging using plus-addresses (user+tag@example.com) - set via verifyConfig() TagsDisablePlus bool // TagsDisableXTags disables message tagging via the X-Tags header - set via verifyConfig() TagsDisableXTags bool )
Functions ¶
func DBTenantID ¶ added in v1.20.7
DBTenantID converts a tenant ID to a DB-friendly value if set
Types ¶
type SMTPForwardConfigStruct ¶ added in v1.22.0
type SMTPForwardConfigStruct struct {
To string `yaml:"to"` // comma-separated list of email addresses
Host string `yaml:"host"` // SMTP host
Port int `yaml:"port"` // SMTP port
STARTTLS bool `yaml:"starttls"` // whether to use STARTTLS
TLS bool `yaml:"tls"` // whether to use TLS
AllowInsecure bool `yaml:"allow-insecure"` // allow insecure authentication, ignore TLS validation
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
OverrideFrom string `yaml:"override-from"` // allow overriding of the from address
ForwardSMTPErrors bool `yaml:"forward-smtp-errors"` // whether to log smtp-errors or forward them to upstream-client
}
SMTPForwardConfigStruct struct for parsing yaml & storing variables
type SMTPRelayConfigStruct ¶ added in v1.14.4
type SMTPRelayConfigStruct struct {
Host string `yaml:"host"` // SMTP host
Port int `yaml:"port"` // SMTP port
STARTTLS bool `yaml:"starttls"` // whether to use STARTTLS
TLS bool `yaml:"tls"` // whether to use TLS
AllowInsecure bool `yaml:"allow-insecure"` // allow insecure authentication, ignore TLS validation
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
OverrideFrom string `yaml:"override-from"` // allow overriding of the from address
AllowedRecipients string `yaml:"allowed-recipients"` // regex, if set needs to match for mails to be relayed
AllowedRecipientsRegexp *regexp.Regexp // compiled regexp using AllowedRecipients
BlockedRecipients string `yaml:"blocked-recipients"` // regex, if set prevents relating to these addresses
BlockedRecipientsRegexp *regexp.Regexp // compiled regexp using BlockedRecipients
PreserveMessageIDs bool `yaml:"preserve-message-ids"` // preserve the original Message-ID when relaying
ForwardSMTPErrors bool `yaml:"forward-smtp-errors"` // whether to log smtp-errors or forward them to upstream-client
// DEPRECATED 2024/03/12
RecipientAllowlist string `yaml:"recipient-allowlist"`
}
SMTPRelayConfigStruct struct for parsing yaml & storing variables
Click to show internal directories.
Click to hide internal directories.