Getting mails when there are failed login

hot to getting mails when there are failed login ?
i found this links, but its not clear
http://forum.mikrotik.com/t/routeros-and-e-mail-of-failed-logins-and-other-system-info/48053/1
http://www.mikrotik.com/testdocs/ros/3.0/aaa/logging.php

any one know a clear steps ?

I put together a script for this a while back. It is meant to be used with the scheduler.
http://forum.mikrotik.com/t/is-it-possible-to-run-a-script-on-login/55422/1

The script searches for any logs that contain the text “logged in” or “login failure”.

:local currentBuf [ :toarray [ /log find message~"logged in" || message~"login failure" ] ] ;

If you only want to check for login failures, it can be changed to this:

:local currentBuf [ :toarray [ /log find message~"login failure" ] ] ;

Thx skot, i’ll try it
plus i found a way on v5.20
from the GUI open the looging as the image, the action then add ,put a a name,from the type chose email,
then the command
set X action=email

and u must add ur google username and password the email tool and enable tls
Capture.PNG
Capture.PNG
Capture.PNG