Documentation
¶
Overview ¶
Package email implements email submission.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidAddress = errors.New("invalid address")
Functions ¶
func AddressValid ¶
AddressValid returns true if addr is a well-formed email address, and if it exactly one email address and not a list. Use AddressValid to check the email address in your application.
Types ¶
type DummyMailer ¶
type DummyMailer struct{}
type SMTP ¶
type SMTP struct { From string `json:"from"` Username string `json:"username"` Password string `json:"password"` Host string `json:"host"` }
SMTP connects to a SMTP server. If the server is not reachable, Send fails.
type Sendmail ¶
type Sendmail struct {
From string
}
Sendmail runs /usr/bin/sendmail to queue an email for sending.
Your sendmail binary probably has the setgid bit set to be able to copy the mail into the queue directory. If your binary runs as a sandboxed systemd service, you might have to disable these options:
LockPersonality MemoryDenyWriteExecute PrivateDevices ProtectClock ProtectHostname ProtectKernelLogs ProtectKernelModules ProtectKernelTunables RestrictAddressFamilies RestrictNamespaces RestrictRealtime RestrictSUIDSGID SystemCallArchitectures SystemCallFilter SystemCallLog
Plus you might have to enable writing to the spool directory, for example:
ReadWritePaths=/var/spool/nullmailer
Click to show internal directories.
Click to hide internal directories.