Add debug logging to sendmail function for improved traceability
continuous-integration/drone/push Build is failing

This commit is contained in:
gyurix
2026-04-12 15:18:59 +02:00
parent 8e215b2574
commit 753eaeab10
+9
View File
@@ -44,10 +44,19 @@ RUN { \
echo ' sender = *from'; \ echo ' sender = *from'; \
echo ' }'; \ echo ' }'; \
echo ''; \ echo ''; \
echo ' debug := os.Getenv("DEBUG") != ""'; \
echo ' if debug {'; \
echo ' fmt.Fprintf(os.Stderr, "[sendmail] relay=%s port=%s sender=%s recipients=%v\n", relay, port, sender, recipients)'; \
echo ' fmt.Fprintf(os.Stderr, "[sendmail] body:\n%s\n", body)'; \
echo ' }'; \
echo ''; \
echo ' if err = smtp.SendMail(relay+":"+port, nil, sender, recipients, body); err != nil {'; \ echo ' if err = smtp.SendMail(relay+":"+port, nil, sender, recipients, body); err != nil {'; \
echo ' fmt.Fprintln(os.Stderr, err)'; \ echo ' fmt.Fprintln(os.Stderr, err)'; \
echo ' os.Exit(1)'; \ echo ' os.Exit(1)'; \
echo ' }'; \ echo ' }'; \
echo ' if debug {'; \
echo ' fmt.Fprintln(os.Stderr, "[sendmail] sent successfully")'; \
echo ' }'; \
echo '}'; \ echo '}'; \
} > main.go } > main.go
RUN go mod init gomail && \ RUN go mod init gomail && \