by P. Andreas Schmidt, IVE
Non-Premium (25 blocks)
Needs free Tasker plugin MailTasker by M. Stornelli (https://play.google.com/store/apps/details?id=com.balda.mailtask)
At the moment, AM doesn't support reading emails, yet. Fortunately with this free Tasker plugin can you get the text and also mark emails read etc. This is more of an example flow for you to toy with. I use it to read out a set of emails from a label whilst I'm on the road. It also has a regex to split text without breaking sentences. Enjoy!
1) install plugin, grant permissions (there's no check done, the flow will simply "crash" without, from the start...)
2) configure your email account as well as labels or other criteria for finding emails, in blocks 2, 40 & 93 (this last is just a copy of 2, so just delete it, copy & paste 2, reconnect)
3) if necessary change language and messages in speak/recognize blocks. If your emails aren't in one language only, check out my detect language flow to get right language for speak block and voila! (I do this, it works: https://llamalab.com/automate/community/flows/41150)
* Unfortunately there seems to be some bug with the plugin. With some (html) emails at least the CSS code remains, which is why there is block 80, to filter those out (if there is). [I have written to the developer but haven't gotten any reply nor seen an update fixing this, if you're interested write him, too, please] Attention: if your emails have curly brackets "}" as part of the message, then anything before will get cut off! If there is also CSS code in those emails you will have to change the way that the code is filtered out, in order not to cut any message text.
* The speak block in AM is limited to 4000 symbols. That's why there's a for each where the length is checked and if necessary split it up into smaller chunks. This is done through a regex that will not cut off in the middle of a sentence, so the text will be read out intact. You can obviously adapt that to be smaller parts, or at every line break.
* You obviously don't have to keep my Bluetooth system that listens for play/pause and next keys, but it's handy when in the car, I find. You could also adapt it so that instead of going to the "next" email it would go to the "next" chunk of text (especially interesting if your email contains different messages and you split them accordingly).
* It will ask at the end if you want to stop, rather than listen to the next one. I find this more practical in the car, since that way I don't actually have to say anything for the flow to read out the next mail.
Problems, comments, suggestions etc welcome!
V2: added in a delay block because it takes some time before the email is marked as read and otherwise you'd get the same email twice... You could of course place the fetch and check for new messages after asking if you want to continue, that way it's definitely marked as read but I found it better to know beforehand that there aren't any new messages.