rano/mailer/transport_dev.go

24 lines
411 B
Go
Raw Normal View History

package mailer
import (
"os"
"path/filepath"
"time"
"gitserver.in/patialtech/rano/util/open"
)
type transportDev struct{}
func (transportDev) send(msg *message) error {
dir := os.TempDir()
id := time.Now().Format("20060102T150405999")
file := filepath.Join(dir, id+".html")
if err := os.WriteFile(file, []byte(msg.HtmlBody), 0440); err != nil {
return err
}
return open.WithDefaultApp(file)
}