Compare commits
No commits in common. "8a6fced9c85a5f2a0b4c98e37d8f67350bc86e4a" and "55d1c2330d09a994af8fc22b7ea7329b830b2b5e" have entirely different histories.
8a6fced9c8
...
55d1c2330d
@ -36,7 +36,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if *testMailFlag {
|
if *testMailFlag {
|
||||||
SendMail(cfg.Email.SmtpHost, cfg.Email.FromEmail, "test backup email topic", "test backup email body", cfg.Email.ToEmail)
|
SendMail(cfg.Email.smtpHost, cfg.Email.fromEmail, "test backup email topic", "test backup email body", cfg.Email.toEmail)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(email.items) > 0 {
|
if len(email.items) > 0 {
|
||||||
SendMail(cfg.Email.SmtpHost, cfg.Email.FromEmail, "Autobackup report", fmt.Sprintf("%v", email.items), cfg.Email.ToEmail)
|
SendMail(cfg.Email.smtpHost, cfg.Email.fromEmail, "Autobackup report", fmt.Sprintf("%v", email.items), cfg.Email.toEmail)
|
||||||
log.Printf("Sending summary email\r\n%v", email.items)
|
log.Printf("Sending summary email\r\n%v", email.items)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,21 +54,21 @@ func (c *Config) Load() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(cfg.Email.SmtpHost) == 0 {
|
if len(cfg.Email.smtpHost) == 0 {
|
||||||
if *debugFlag {
|
if *debugFlag {
|
||||||
log.Printf("Config.Load : no smtp")
|
log.Printf("Config.Load : no smtp")
|
||||||
}
|
}
|
||||||
return fmt.Errorf("no smtp")
|
return fmt.Errorf("no smtp")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(cfg.Email.FromEmail) == 0 {
|
if len(cfg.Email.fromEmail) == 0 {
|
||||||
if *debugFlag {
|
if *debugFlag {
|
||||||
log.Printf("Config.Load : no email from")
|
log.Printf("Config.Load : no email from")
|
||||||
}
|
}
|
||||||
return fmt.Errorf("no email from")
|
return fmt.Errorf("no email from")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(cfg.Email.ToEmail) == 0 {
|
if len(cfg.Email.toEmail) == 0 {
|
||||||
if *debugFlag {
|
if *debugFlag {
|
||||||
log.Printf("Config.Load : no email to")
|
log.Printf("Config.Load : no email to")
|
||||||
}
|
}
|
||||||
|
6
email.go
6
email.go
@ -14,9 +14,9 @@ type Email struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type EmailConfig struct {
|
type EmailConfig struct {
|
||||||
SmtpHost string `json:"smtp"`
|
smtpHost string `json:"smtp"`
|
||||||
FromEmail string `json:"email_from"`
|
fromEmail string `json:"email_from"`
|
||||||
ToEmail []string `json:"email_to"`
|
toEmail []string `json:"email_to"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func SendMail(addr, from, subject, body string, to []string) error {
|
func SendMail(addr, from, subject, body string, to []string) error {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Code generated by version.sh (@generated) DO NOT EDIT.
|
// Code generated by version.sh (@generated) DO NOT EDIT.
|
||||||
package main
|
package main
|
||||||
var githash = "fcc9fa3"
|
var githash = "f2509f0"
|
||||||
var buildstamp = "2022-06-19_04:33:26"
|
var buildstamp = "2022-06-19_04:31:26"
|
||||||
var commits = "50"
|
var commits = "48"
|
||||||
var version = "fcc9fa3-b50 - 2022-06-19_04:33:26"
|
var version = "f2509f0-b48 - 2022-06-19_04:31:26"
|
||||||
|
Loading…
Reference in New Issue
Block a user