Hi there,
The requirements are quite clear and straightforward to implement. If I'm not mistaken currently opened email will be checked against the records in mysql, specifically from 2 tables mentioned ATS and CRM. If there's a match certain information from the database will be displayed and if not no info found message will be displayed instead.
For such cross matching we need to use a unique identifier for each email. I'm not sure if the information to be displayed is related to email itself or the person sending the email. If it's latter obviously we'll use email address of that person for matching but if it's the former we need something else like message id.
I am planning to use JDBC service available for appscripts to connect to databases directly. However, in this case you need to allow remote access to your database. If you have security concerns because of that we can instead use a small script, e.g python, php, ect., deployed to a web server, preferably within your private network, as a frontend to access the database. That way appscript can call the script which in return query the database and send the data back to appscript.
Anyway, please let me know if I'm missing anything here. I expect this to be ready in a day or two at most, thanks.