28 lines
568 B
Go
28 lines
568 B
Go
// 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)
|
|
}
|