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 {
|
||||
|
|
|
|||
|
|
@ -71,13 +71,6 @@ func Definition() *sdk.CheckerDefinition {
|
|||
Choices: []string{"starttls", "tls", "none"},
|
||||
Default: "starttls",
|
||||
},
|
||||
{
|
||||
Id: "from_address",
|
||||
Type: "string",
|
||||
Label: "From address",
|
||||
Description: "Address used in the From header of the test email. Must be in the tested domain.",
|
||||
Required: true,
|
||||
},
|
||||
{
|
||||
Id: "subject_override",
|
||||
Type: "string",
|
||||
|
|
@ -119,6 +112,12 @@ func Definition() *sdk.CheckerDefinition {
|
|||
Label: "Domain name",
|
||||
AutoFill: sdk.AutoFillDomainName,
|
||||
},
|
||||
{
|
||||
Id: "from_address",
|
||||
Type: "string",
|
||||
Label: "From address",
|
||||
Description: "Address used in the From header of the test email. Must be in the tested domain. Defaults to no-reply@<domain>.",
|
||||
},
|
||||
},
|
||||
},
|
||||
Rules: []sdk.CheckRule{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue