diff --git a/email.go b/email.go index 9d1687e..7ad606e 100644 --- a/email.go +++ b/email.go @@ -27,21 +27,36 @@ func SendMail(addr, from, subject, body string, to []string) error { c, err := smtp.Dial(addr) if err != nil { + if *debugFlag { + log.Printf("SendMail : smtp.Dial (%s)", err) + } return err } + defer c.Close() + if err = c.Mail(r.Replace(from)); err != nil { + if *debugFlag { + log.Printf("SendMail : client.Mail (%s)", err) + } return err } + for i := range to { to[i] = r.Replace(to[i]) if err = c.Rcpt(to[i]); err != nil { + if *debugFlag { + log.Printf("SendMail : client.Rcpt (%s)", err) + } return err } } w, err := c.Data() if err != nil { + if *debugFlag { + log.Printf("SendMail : client.Data (%s)", err) + } return err } @@ -58,11 +73,23 @@ func SendMail(addr, from, subject, body string, to []string) error { _, err = w.Write([]byte(msg)) if err != nil { + if *debugFlag { + log.Printf("SendMail : writer.Write (%s)", err) + } return err } + err = w.Close() if err != nil { + if *debugFlag { + log.Printf("SendMail : writer.Close (%s)", err) + } return err } - return c.Quit() + + err = c.Quit() + if *debugFlag { + log.Printf("SendMail : client.Quit (%s)", err) + } + return err } diff --git a/version.go b/version.go index b4c7be6..0313f71 100644 --- a/version.go +++ b/version.go @@ -1,6 +1,6 @@ // Code generated by version.sh (@generated) DO NOT EDIT. package main -var githash = "4937155" -var buildstamp = "2022-06-19_04:13:42" -var commits = "44" -var version = "4937155-b44 - 2022-06-19_04:13:42" +var githash = "db05204" +var buildstamp = "2022-06-19_04:18:29" +var commits = "45" +var version = "db05204-b45 - 2022-06-19_04:18:29"