Emailing management, administration improvement, Carpooling in multimodal search
This commit is contained in:
22
renderer/mailer.go
Normal file
22
renderer/mailer.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package renderer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.coopgo.io/coopgo-platform/emailing"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func NewEmailingHandler(cfg *viper.Viper) (*emailing.Mailer, error) {
|
||||
templates_dir := cfg.GetString("templates.root")
|
||||
|
||||
theme := viper.New()
|
||||
theme.SetConfigName("config")
|
||||
theme.AddConfigPath(templates_dir)
|
||||
err := theme.ReadInConfig()
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("fatal error config file: %w", err))
|
||||
}
|
||||
|
||||
return emailing.NewMailer(templates_dir, theme.Sub("emails"), cfg.Sub("emailing.smtp"))
|
||||
}
|
||||
Reference in New Issue
Block a user