parcoursmob/core/application/support.go

34 lines
693 B
Go
Executable File

package application
import (
"context"
"fmt"
"github.com/rs/zerolog/log"
)
type Message struct {
Content string
}
func (h *ApplicationHandler) SendSupportMessage(ctx context.Context, comment, userEmail string) error {
data := map[string]any{
"key": comment,
"user": userEmail,
}
supportEmail := h.config.GetString("modules.support.email")
if supportEmail == "" {
supportEmail = "support@mobicoop.fr"
}
log.Debug().Str("user_email", userEmail).Str("support_email", supportEmail).Msg("Sending support message")
if err := h.emailing.Send("support.request", supportEmail, data); err != nil {
return fmt.Errorf("failed to send support email: %w", err)
}
return nil
}