Ability to email on DNS event for specific domain?



I’m hoping to be able to send an email when specific (not blocked) websites are visited as a form of alerting/monitoring system.

If this can be filtered based on source IP too that would be even better.

Is this possible?

I’ve tried to find other posts as suspect this will have come up before but I’m not having any luck.




There is no Pi-hole specific way to do this AFAIK but what you could probably do to accomplish this is setup a tool that watches the query log of Pi-hole and perform actions in response to certain matches in the query log.

One such tool designed exactly for WATCH X and DO Y type actions is already available on most linux os distros: Fail2Ban

You point it at a log file and it performs an action in response. The original/main/default purpose of fail2ban, as the name implies, is to watch for failed login attempts and ban the IP address but it was written generically enough that you can tell it’s configs to watch any log file, and then run any shell script in response.

The ball is in your court : https://duckduckgo.com/?q=fail2ban+for+email+alerts


Or check out this post: