It is very easy with Python.
1. Create an email account
2. Select a SMTP server (Microsoft or Google)
3. Create MySQL user account with select privileges on last login column in login table.
4. Connect to MySQL server using limited privilege MySQL user account with SqlAlchemy (http://www.sqlalchemy.org)
5. Query database and calculate the datetime difference to get timedelta, which gives number of days, hours, and seconds. (https://docs.python....y/datetime.html)
6. Send email via SMTP server for all user's last login > 20 days. (https://docs.python....ry/smtplib.html)
7. Create separate user account on system. (https://pypi.python..../python-crontab)
8. Schedule script on crontab to run on some interval using new user account.
Can be done in less than 100 lines. (Unless you want to use the ORM to map all the tables.)
Deploy on some cloud instance
1. Buy a cloud instance for $5 per month or less.
2. Setup SSL certificates for MySQL server master and slave. (Self-signed root CA is ok)
3. Setup Iptables to allow cloud instance to connect on MySQL port.
4. Setup MySQL slave replication.
5. Write automation script that use slave replication server. (Which also double as backup)