Flip starttls flag to fix #58

This commit is contained in:
Michael de Wit 2021-11-01 18:56:45 +01:00
parent c75190e21a
commit 7340d3d417
3 changed files with 7 additions and 7 deletions

View file

@ -10,7 +10,7 @@ You can configure the plugin using the following parameters:
* **username** - SMTP username
* **password** - SMTP password
* **skip_verify** - Skip verification of SSL certificates, defaults to `false`
* **starttls** - Enable/Disable STARTTLS
* **no_starttls** - Enable/Disable STARTTLS
* **recipients** - List of recipients to send this mail to (besides the commit author)
* **recipients_file** - Filename to load additional recipients from (textfile with one email per line) (besides the commit author)
* **recipients_only** - Do not send mails to the commit author, but only to **recipients**, defaults to `false`
@ -145,5 +145,5 @@ steps:
host: smtp.mailgun.org
username: octocat
password: 12345
+ starttls: false
+ no_starttls: true
```

View file

@ -67,9 +67,9 @@ func main() {
EnvVar: "PLUGIN_SKIP_VERIFY",
},
cli.BoolFlag{
Name: "starttls",
Name: "no.starttls",
Usage: "Enable/Disable STARTTLS",
EnvVar: "PLUGIN_STARTTLS",
EnvVar: "PLUGIN_NO_STARTTLS",
},
cli.StringFlag{
Name: "recipients.file",
@ -412,7 +412,7 @@ func run(c *cli.Context) error {
Username: c.String("username"),
Password: c.String("password"),
SkipVerify: c.Bool("skip.verify"),
StartTLS: c.Bool("starttls"),
NoStartTLS: c.Bool("no.starttls"),
Recipients: c.StringSlice("recipients"),
RecipientsFile: c.String("recipients.file"),
RecipientsOnly: c.Bool("recipients.only"),

View file

@ -88,7 +88,7 @@ type (
Username string
Password string
SkipVerify bool
StartTLS bool
NoStartTLS bool
Recipients []string
RecipientsFile string
RecipientsOnly bool
@ -153,7 +153,7 @@ func (p Plugin) Exec() error {
dialer.TLSConfig = &tls.Config{InsecureSkipVerify: true}
}
if !p.Config.StartTLS {
if p.Config.NoStartTLS {
dialer.StartTLSPolicy = gomail.NoStartTLS
}