From 6c36e04c1f7f7e222c71c5c8e7e7337744fe9c34 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 14 May 2019 13:07:48 -0400 Subject: Add :send-message, prepares & writes email to /tmp --- commands/compose/send-message.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 commands/compose/send-message.go (limited to 'commands/compose') diff --git a/commands/compose/send-message.go b/commands/compose/send-message.go new file mode 100644 index 0000000..b9fc9d2 --- /dev/null +++ b/commands/compose/send-message.go @@ -0,0 +1,29 @@ +package compose + +import ( + "errors" + "os" + + "git.sr.ht/~sircmpwn/aerc2/widgets" +) + +func init() { + register("send-message", SendMessage) +} + +func SendMessage(aerc *widgets.Aerc, args []string) error { + if len(args) > 1 { + return errors.New("Usage: send-message") + } + composer, _ := aerc.SelectedTab().(*widgets.Composer) + //config := composer.Config() + f, err := os.Create("/tmp/test.eml") + if err != nil { + panic(err) + } + _, err = composer.Message(f) + if err != nil { + panic(err) + } + return nil +} -- cgit 1.4.1-2-gfad0