22 lines
783 B
Go
22 lines
783 B
Go
|
|
package smtp
|
||
|
|
|
||
|
|
// Config holds SMTP connection settings. All fields are optional; an empty Host
|
||
|
|
// activates no-op mode. Use [DefaultConfig] to start from production-safe defaults.
|
||
|
|
type Config struct {
|
||
|
|
// Host is the SMTP server hostname. Empty string enables no-op mode.
|
||
|
|
Host string `env:"EINHERJAR_SMTP_HOST"`
|
||
|
|
Port int `env:"EINHERJAR_SMTP_PORT" envDefault:"587"`
|
||
|
|
User string `env:"EINHERJAR_SMTP_USER"`
|
||
|
|
Password string `env:"EINHERJAR_SMTP_PASSWORD"`
|
||
|
|
// From is the envelope sender address used for all outgoing messages.
|
||
|
|
From string `env:"EINHERJAR_SMTP_FROM"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// DefaultConfig returns a Config with production-safe defaults.
|
||
|
|
// Callers must supply Host and From for real SMTP delivery.
|
||
|
|
func DefaultConfig() Config {
|
||
|
|
return Config{
|
||
|
|
Port: 587,
|
||
|
|
}
|
||
|
|
}
|