Add debug logging to sendmail function for improved traceability
continuous-integration/drone/push Build is failing
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -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 && \
|
||||||
|
|||||||
Reference in New Issue
Block a user