rano/mailer/transport_dev.go

28 lines
568 B
Go
Raw Permalink Normal View History

2024-11-18 15:23:13 +00:00
// Copyright 2024 Patial Tech. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
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)
}