1
0
mirror of https://github.com/taigrr/godns synced 2025-01-18 04:03:25 -08:00

send mail notification

This commit is contained in:
TimothyYe 2019-01-21 11:11:07 +08:00
parent 304d3cac50
commit 66187e0269

View File

@ -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)
}