fix(quality): switch linter and fix errors
This commit is contained in:
@@ -2,12 +2,15 @@ package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"me-fit/types"
|
||||
"net/smtp"
|
||||
|
||||
"me-fit/types"
|
||||
"me-fit/utils"
|
||||
)
|
||||
|
||||
type MailService interface {
|
||||
SendMail(to string, subject string, message string) error
|
||||
// Sending an email is a fire and forget operation. Thus no error handling
|
||||
SendMail(to string, subject string, message string)
|
||||
}
|
||||
|
||||
type MailServiceImpl struct {
|
||||
@@ -18,9 +21,9 @@ func NewMailServiceImpl(serverSettings *types.ServerSettings) MailServiceImpl {
|
||||
return MailServiceImpl{serverSettings: serverSettings}
|
||||
}
|
||||
|
||||
func (m MailServiceImpl) SendMail(to string, subject string, message string) error {
|
||||
func (m MailServiceImpl) SendMail(to string, subject string, message string) {
|
||||
if m.serverSettings.Smtp == nil {
|
||||
return nil
|
||||
return
|
||||
}
|
||||
|
||||
s := m.serverSettings.Smtp
|
||||
@@ -29,5 +32,8 @@ func (m MailServiceImpl) SendMail(to string, subject string, message string) err
|
||||
|
||||
msg := fmt.Sprintf("From: %v <%v>\nTo: %v\nSubject: %v\nMIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n%v", s.FromName, s.FromMail, to, subject, message)
|
||||
|
||||
return smtp.SendMail(s.Host+":"+s.Port, auth, s.FromMail, []string{to}, []byte(msg))
|
||||
err := smtp.SendMail(s.Host+":"+s.Port, auth, s.FromMail, []string{to}, []byte(msg))
|
||||
if err != nil {
|
||||
utils.LogError("Error sending mail: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user