[fix issue 1484] Allow to send email without auth again (#1485)
* We can now send email with plain auth * better defaults for email plugin Co-authored-by: sabban <15465465+sabban@users.noreply.github.com>
This commit is contained in:
parent
a645c928d4
commit
589a30cd5f
|
@ -53,11 +53,12 @@ type EmailPlugin struct {
|
||||||
|
|
||||||
func (n *EmailPlugin) Configure(ctx context.Context, config *protobufs.Config) (*protobufs.Empty, error) {
|
func (n *EmailPlugin) Configure(ctx context.Context, config *protobufs.Config) (*protobufs.Empty, error) {
|
||||||
d := PluginConfig{
|
d := PluginConfig{
|
||||||
SMTPPort: 587,
|
SMTPPort: 25,
|
||||||
SenderName: "Crowdsec",
|
SenderName: "Crowdsec",
|
||||||
EmailSubject: "Crowdsec notification",
|
EmailSubject: "Crowdsec notification",
|
||||||
EncryptionType: "ssltls",
|
EncryptionType: "ssltls",
|
||||||
AuthType: "login",
|
AuthType: "login",
|
||||||
|
SenderEmail: "crowdsec@crowdsec.local",
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := yaml.Unmarshal(config.Config, &d); err != nil {
|
if err := yaml.Unmarshal(config.Config, &d); err != nil {
|
||||||
|
@ -72,18 +73,6 @@ func (n *EmailPlugin) Configure(ctx context.Context, config *protobufs.Config) (
|
||||||
return nil, fmt.Errorf("SMTP host is not set")
|
return nil, fmt.Errorf("SMTP host is not set")
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.SMTPUsername == "" {
|
|
||||||
return nil, fmt.Errorf("SMTP username is not set")
|
|
||||||
}
|
|
||||||
|
|
||||||
if d.SMTPPassword == "" {
|
|
||||||
return nil, fmt.Errorf("SMTP password is not set")
|
|
||||||
}
|
|
||||||
|
|
||||||
if d.SenderEmail == "" {
|
|
||||||
return nil, fmt.Errorf("Sender email is not set")
|
|
||||||
}
|
|
||||||
|
|
||||||
if d.ReceiverEmails == nil || len(d.ReceiverEmails) == 0 {
|
if d.ReceiverEmails == nil || len(d.ReceiverEmails) == 0 {
|
||||||
return nil, fmt.Errorf("Receiver emails are not set")
|
return nil, fmt.Errorf("Receiver emails are not set")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue