32 lines
642 B
Go
32 lines
642 B
Go
package email
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/spf13/viper"
|
|
"gopkg.in/gomail.v2"
|
|
"kumoly.io/kumoly/app/system"
|
|
)
|
|
|
|
type Service struct {
|
|
system.BaseService
|
|
}
|
|
|
|
func (srv Service) GetName() string { return "email.Service" }
|
|
|
|
func (srv *Service) Init() error {
|
|
app.Name = viper.GetString("name")
|
|
app.Copyright = fmt.Sprintf("Copyright © %v %s. All rights reserved.",
|
|
time.Now().Year(), viper.GetString("name"))
|
|
app.Link = viper.GetString("server.url")
|
|
|
|
dial = gomail.NewDialer(
|
|
viper.GetString("email.host"),
|
|
viper.GetInt("email.port"),
|
|
viper.GetString("email.username"),
|
|
viper.GetString("email.password"))
|
|
|
|
return nil
|
|
}
|