aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose/send-message.go
blob: b9fc9d2b180b1df1e5526a6893d15b58f10161b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
}