Fix email sending on the sudo page

This commit is contained in:
Eli Ribble 2026-02-18 21:38:16 +00:00
parent 2d61532dd1
commit 4100263393
No known key found for this signature in database
3 changed files with 12 additions and 3 deletions

View file

@ -86,7 +86,16 @@ func Send(ctx context.Context, email Request) (result emailResponse, err error)
}
if r.IsError() {
log.Error().Int("status", err_resp.StatusCode).Str("error", err_resp.Error).Str("msg", err_resp.Message).Msg("Email send error")
log.Error().
Int("status", err_resp.StatusCode).
Str("error", err_resp.Error).
Str("msg", err_resp.Message).
Str("email.from", email.From).
Str("email.sender", email.Sender).
Str("email.subject", email.Subject).
Str("email.to", email.To).
Str("email.text", email.Text).
Msg("Email send error")
return result, fmt.Errorf("Error response %d from email service: %s (%s)", err_resp.StatusCode, err_resp.Message, err_resp.Error)
}
return result, nil

View file

@ -148,7 +148,7 @@
<form action="/sudo/email" method="POST">
<div class="mb-3">
<label for="emailFrom" class="form-label">From Account</label>
<select class="form-select" id="emailFrom">
<select class="form-select" id="emailFrom" name="emailFrom">
<option value="{{ .C.ForwardEmailRMOAddress }}">
{{ .C.ForwardEmailRMOAddress }}
</option>

View file

@ -61,7 +61,7 @@ func postSudoEmail(ctx context.Context, u *models.User, e FormEmail) (string, *e
if err != nil {
log.Warn().Err(err).Msg("Failed to send email")
} else {
log.Info().Str("id", resp.ID).Msg("Sent Email...?")
log.Info().Str("id", resp.ID).Str("to", e.To).Msg("Sent Email")
}
return "/sudo", nil
}