Email processing is a very important element in many RPA solutions. Let’s see how you can do it in G1ANT.Robot.
The most universal email command is the
mail.imap command from the Net Addon — in order to use it, you need to enable the addon in the Addons panel to the left of the script editor: just click the check box next to the net entry to select it.
Suppose you want to retrieve today’s emails from your Gmail account and see their subjects:
♥login = enter your Gmail login here ♥password = enter your Gmail password here mail.imap imap.gmail.com login ♥login password ♥password sincedate ♥date onlyunreadmessages true ignorecertificateerrors true result ♥list foreach ♥element in ♥list dialog ♥element end
mail.imap command logs in to your email account with provided credentials (your
♥password) and retrieves emails received today (the
♥date special variable returns the current date for the
sincedate argument). The messages are stored as a list in the
♥list variable. They are picked from there one by one and displayed in the
In this script, the robot displays only the mail subject. If you want to see other message elements — sender name, message body, attachments and so forth — you need to dig a bit deeper in the message list. And this is what you’re about to do in the next lesson.