My company has a shared Gmail address for 3 departments in the company, each department handling different works.
When our clients send emails to the shared address, they will first be read by a responsible person in the administrative office and then be forwarded manually to 3 email addresses of the 3 departments for handling. The process is so laborious. In addition, the person may forget to forward the emails and when the person is out of her cubicle, emails will not be forwarded.
We wish to replace the manual process by the automatic forwarding by Google Script. Emails will be automatically forwarded based on the clients of each department. Let say, if the email address of the sender contain "@company_A.com", it will be auto-forwarded to department 1.
We think we could achieve that by using Google script so that the script will get the address of the sender, check if it contains certain strings, and forward the emails that meet conditions. We would like to get the 50 newest messages in the inbox and check.
However, we are stuck with a problem: if each time we check 50 latest messages, how could we avoid forwarding the already forwarded messages from the previous time.
Thank you for any suggestion.