diff --git a/main.go b/main.go index 6267123..00356ab 100644 --- a/main.go +++ b/main.go @@ -79,6 +79,11 @@ func main() { Usage: "attachment filename", EnvVar: "PLUGIN_ATTACHMENT", }, + cli.StringSliceFlag{ + Name: "attachments", + Usage: "attachment filename(s)", + EnvVar: "PLUGIN_ATTACHMENTS", + }, // Drone environment // Repo @@ -375,6 +380,7 @@ func run(c *cli.Context) error { Subject: c.String("template.subject"), Body: c.String("template.body"), Attachment: c.String("attachment"), + Attachments: c.StringSlice("attachments"), }, } diff --git a/plugin.go b/plugin.go index 0d7ddea..0557187 100644 --- a/plugin.go +++ b/plugin.go @@ -89,6 +89,7 @@ type ( Subject string Body string Attachment string + Attachments []string } Plugin struct { @@ -203,6 +204,10 @@ func (p Plugin) Exec() error { message.Attach(p.Config.Attachment) } + for _, attachment := range p.Config.Attachments { + message.Attach(attachment) + } + if err := gomail.Send(closer, message); err != nil { log.Errorf("Could not send email to %q: %v", recipient, err) return err