Move from_address to domain options with no-reply default
This commit is contained in:
parent
1588131e90
commit
10a65aed02
2 changed files with 11 additions and 8 deletions
|
|
@ -158,7 +158,11 @@ func loadConfig(opts sdk.CheckerOptions) (*runConfig, error) {
|
|||
return nil, fmt.Errorf("smtp_host is required")
|
||||
}
|
||||
if cfg.FromAddress == "" {
|
||||
return nil, fmt.Errorf("from_address is required")
|
||||
domain := strings.TrimSpace(stringOpt(opts, "domain_name"))
|
||||
if domain == "" {
|
||||
return nil, fmt.Errorf("from_address is required when domain_name is not set")
|
||||
}
|
||||
cfg.FromAddress = "no-reply@" + strings.TrimSuffix(domain, ".")
|
||||
}
|
||||
parsedFrom, err := mail.ParseAddress(cfg.FromAddress)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue