summary refs log tree commit diff stats
path: root/commands/compose/send-message.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-14 13:07:48 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-14 13:07:48 -0400
commit6c36e04c1f7f7e222c71c5c8e7e7337744fe9c34 (patch)
tree52695aa088a565808275582f138cf673c0066d76 /commands/compose/send-message.go
parentd5e82ecfe05065a84f1e13bee44e309b8e1559bd (diff)
downloadaerc-6c36e04c1f7f7e222c71c5c8e7e7337744fe9c34.tar.gz
Add :send-message, prepares & writes email to /tmp
Diffstat (limited to 'commands/compose/send-message.go')
-rw-r--r--commands/compose/send-message.go29
1 files changed, 29 insertions, 0 deletions
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
+}