diff --git a/Dockerfile b/Dockerfile index a689d41..312afe8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,10 +44,19 @@ RUN { \ echo ' sender = *from'; \ 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 ' fmt.Fprintln(os.Stderr, err)'; \ echo ' os.Exit(1)'; \ echo ' }'; \ + echo ' if debug {'; \ + echo ' fmt.Fprintln(os.Stderr, "[sendmail] sent successfully")'; \ + echo ' }'; \ echo '}'; \ } > main.go RUN go mod init gomail && \