24 lines
411 B
Go
24 lines
411 B
Go
|
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)
|
||
|
}
|