func (m *MessageCache) Save() error {
	confPath := path.Join(path.Dir(viper.ConfigFileUsed()), "inflight.json")
	for _, msg := range *m {
		if err := msg.Save(); err != nil {
			return err
		}
	}
	b, err := json.Marshal(m)
	if err != nil {
		return err
	}
	var out bytes.Buffer
	json.Indent(&out, b, "", "  ")
	return ioutil.WriteFile(confPath, out.Bytes(), 0600)
}
Save seralizes the MessageCache to a canonical disk location.
package cache
import (
	"bytes"
	"encoding/json"
	"io/ioutil"
	"os"
	"path"
	"github.com/spf13/viper"
	"github.com/willscott/gosendmail/lib"
)
type MessageCache []lib.ParsedMessage