Update
This commit is contained in:
@@ -3,7 +3,9 @@ package brevo
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"enaklo-pos-be/internal/common/logger"
|
||||
"enaklo-pos-be/internal/entity"
|
||||
"go.uber.org/zap"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
@@ -22,7 +24,7 @@ type ServiceImpl struct {
|
||||
func (s ServiceImpl) SendEmailTransactional(ctx context.Context, param entity.SendEmailNotificationParam) error {
|
||||
templateFile, err := ioutil.ReadFile(param.TemplatePath)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
logger.ContextLogger(ctx).Error("error when reading file template", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -91,9 +93,11 @@ func (s ServiceImpl) sendEmail(ctx context.Context, tmpl *template.Template, par
|
||||
|
||||
_, _, err = s.brevoConn.TransactionalEmailsApi.SendTransacEmail(ctx, payload)
|
||||
if err != nil {
|
||||
logger.ContextLogger(ctx).Error("error when sending email", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
|
||||
logger.ContextLogger(ctx).Info("sending email success")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user