I want to print inbox messages one by one (like cat someFile
) so that I can parse the message contents.
something like printGmail InboxMesg1 | grep some | sed some
Using curl
I can access the first inbox message
curl -u '*myusername:mypassword*' -X "SEARCH UNSEEN" imaps://imap.gmail.com:993/INBOX
For example I can tell my self to execute a command by email curl -u '*myusername:mypassword*' -X "SEARCH UNSEEN" imaps://imap.gmail.com:993/INBOX grep someCommand && echo request received executing command
How I can print the last (newest), 2nd last, etc messages. Also how to read emails in other folders such as spam, sent, etc