diff --git a/backup.go b/backup.go index 58b8bd1..8a65999 100644 --- a/backup.go +++ b/backup.go @@ -36,7 +36,7 @@ func main() { } 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) } @@ -47,7 +47,7 @@ func main() { } 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) } } diff --git a/config.go b/config.go index 6297ba9..bc2c2fd 100644 --- a/config.go +++ b/config.go @@ -54,21 +54,21 @@ func (c *Config) Load() error { return err } - if len(cfg.Email.smtpHost) == 0 { + if len(cfg.Email.SmtpHost) == 0 { if *debugFlag { log.Printf("Config.Load : no smtp") } return fmt.Errorf("no smtp") } - if len(cfg.Email.fromEmail) == 0 { + if len(cfg.Email.FromEmail) == 0 { if *debugFlag { log.Printf("Config.Load : no email from") } return fmt.Errorf("no email from") } - if len(cfg.Email.toEmail) == 0 { + if len(cfg.Email.ToEmail) == 0 { if *debugFlag { log.Printf("Config.Load : no email to") } diff --git a/email.go b/email.go index fbe20d5..6d0a856 100644 --- a/email.go +++ b/email.go @@ -14,9 +14,9 @@ type Email struct { } type EmailConfig struct { - smtpHost string `json:"smtp"` - fromEmail string `json:"email_from"` - toEmail []string `json:"email_to"` + SmtpHost string `json:"smtp"` + FromEmail string `json:"email_from"` + ToEmail []string `json:"email_to"` } func SendMail(addr, from, subject, body string, to []string) error {