What do you mean with "when some pages are going to 404 error"? Do you mean when something enters a URL which is not present in AEM and therefor returns a 404?
I would refrain from such a feature, because a simple typo and even some bot trying wordpress-style URLs on your AEM (which should always return a 404) will return a 404. If you implement an alert, that's a really nice way to spam your alert inbox.
Instead rather have a look into your dispatcher logfiles, extract all 404 requests and then periodically review these requests, extract patterns and decide if you want to implement either redirects, aliases or just create a page with the correct name at that location.