summary refs log blame commit diff stats
path: root/commands/compose/send-message.go
blob: b9fc9d2b180b1df1e5526a6893d15b58f10161b6 (plain) (tree)




























                                                             
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
}