more debug
This commit is contained in:
parent
db052048b6
commit
f3abe27055
29
email.go
29
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
|
||||
}
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user