Add ReplyTo header when sending email tu support
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 1m41s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 1m41s
This commit is contained in:
@@ -127,6 +127,8 @@ func (h *ApplicationHandler) AgendaCreateEvent(w http.ResponseWriter, r *http.Re
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
log.Debug().Any("eventFrom", eventForm).Msg("Form data submitted to create event")
|
||||
|
||||
data, _ := structpb.NewStruct(map[string]any{
|
||||
"address": eventForm.Address,
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"git.coopgo.io/coopgo-apps/parcoursmob/utils/identification"
|
||||
"git.coopgo.io/coopgo-platform/emailing"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
@@ -22,16 +23,22 @@ func (h *ApplicationHandler) SupportSend(w http.ResponseWriter, r *http.Request)
|
||||
current_user_claims := c.(map[string]any)
|
||||
|
||||
comment := r.PostFormValue(("comment"))
|
||||
|
||||
|
||||
if r.Method == "POST" {
|
||||
user_email := current_user_claims["email"].(string)
|
||||
|
||||
data := map[string]any{
|
||||
"key": comment,
|
||||
"user": current_user_claims["email"],
|
||||
"user": user_email,
|
||||
}
|
||||
|
||||
if err := h.emailing.Send("support.request", "support@parcoursmob.fr", data); err != nil {
|
||||
log.Error().Err(err).Msg("")
|
||||
log.Debug().Str("user_email", user_email).Msg("Sending message")
|
||||
|
||||
if err := h.emailing.Send("support.request", "support@parcoursmob.fr", data, emailing.WithReplyTo(user_email), emailing.WithTLSOpportunistic()); err != nil {
|
||||
log.Error().Err(err).Msg("error sending email")
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/app/", http.StatusFound)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user