From 66187e02694187b89f94d66f97d5fb842397012f Mon Sep 17 00:00:00 2001 From: TimothyYe Date: Mon, 21 Jan 2019 11:11:07 +0800 Subject: [PATCH] send mail notification --- handler/cloudflare_handler.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/handler/cloudflare_handler.go b/handler/cloudflare_handler.go index 2bc2566..8c51ba4 100644 --- a/handler/cloudflare_handler.go +++ b/handler/cloudflare_handler.go @@ -103,6 +103,12 @@ func (handler *CloudflareHandler) DomainLoop(domain *godns.Domain, panicChan cha if rec.IP != currentIP { log.Printf("IP mismatch: Current(%+v) vs Cloudflare(%+v)\r\n", currentIP, rec.IP) handler.updateRecord(rec, currentIP) + + // Send mail notification if notify is enabled + if handler.Configuration.Notify.Enabled { + log.Print("Sending notification to:", handler.Configuration.Notify.SendTo) + godns.SendNotify(handler.Configuration, rec.Name, currentIP) + } } else { log.Printf("Record OK: %+v - %+v\r\n", rec.Name, rec.IP) }