diff options
author | Reto Brunner <reto@labrat.space> | 2019-07-28 14:33:46 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-07-29 14:51:12 -0400 |
commit | c81b3eb1cb8f25fb563b7d9ea99814e9ba21c737 (patch) | |
tree | 31a1267212475f54c14f9a40d697e32fe004389c /commands/compose/send.go | |
parent | 989730d47000feb297b5fab4e273a9d9b13c5741 (diff) | |
download | aerc-c81b3eb1cb8f25fb563b7d9ea99814e9ba21c737.tar.gz |
Sendmail: allow for arbitrary parameters
Allows the outgoing command to contain arguments and flags
Diffstat (limited to 'commands/compose/send.go')
-rw-r--r-- | commands/compose/send.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/commands/compose/send.go b/commands/compose/send.go index 29da94da..202d8c6c 100644 --- a/commands/compose/send.go +++ b/commands/compose/send.go @@ -14,6 +14,7 @@ import ( "github.com/emersion/go-sasl" "github.com/emersion/go-smtp" "github.com/gdamore/tcell" + "github.com/google/shlex" "github.com/miolini/datacounter" "github.com/pkg/errors" @@ -183,7 +184,16 @@ func (_ Send) Execute(aerc *widgets.Aerc, args []string) error { } sendmailAsync := func() (int, error) { - cmd := exec.Command(uri.Path, rcpts...) + args, err := shlex.Split(uri.Path) + if err != nil { + return 0, err + } + if len(args) == 0 { + return 0, fmt.Errorf("no command specified") + } + bin := args[0] + args = append(args[1:], rcpts...) + cmd := exec.Command(bin, args...) wc, err := cmd.StdinPipe() if err != nil { return 0, errors.Wrap(err, "cmd.StdinPipe") |