If you choose to try it, I would enjoy reading your results, if you don't mind posting it back here.
OR maybe all this is much easier and someone will post the exact answer for us here; I hope so.
I would generally send an email from an After script, once you know that something took place, and now you want to send notification of it. The script will run asynchronously.
So, let's use the case of sending a message whenever an entry in library A is either created or updated. So, add two triggers into A, one for event Creating a new entry and phase After saving the entry and the other for event Updating an existing entry and phase After saving the entry. Put the same script in each, though you make a small change, if you want. Here's the script.
CAVEAT: It's probably easy (like yet another i.extra() call with a path name), but I don't know how to add an attachment to the message. I hope someone will respond with that trick, as well.
var i = intent("android.intent.action.SENDTO");
i.data("mailto:ja...@doe.com, jo...@doe.com"); // addresses where to send
i.extra("android.intent.extra.SUBJECT", entry().field("Subject")); // 2nd arg is what you want
i.extra("android.intent.extra.TEXT", entry().field("Body")); // 2nd arg is what you want
i.extra("android.intent.extra.ATTACHMENT", "storage/memento/files/myPhoto.jpg"); // THIS IS A GUESS!
i.send(); // send it out
Reference your Calculation field within the string you supply as the second argument to one of the i.extra() function calls. For instance:
i.extra("android.intent.extra.TEXT", "Prelude " + entry().field("myCalculation") + " Postlude");
I'm sure the ATTACHMENT "extra" line I guessed at is wrong. I didn't find the actual answer, but the Java-based examples I found suggested to me that maybe the right symbol, instead of ATTACHMENT, might be STREAM, but that's still a guess on my part.
After a few deadlines I'm working against are passed, I'll try to get it working myself, but in the meantime, could someone who knows please tell us how to code the attachment of a file (photo) to the email (code in previous post)? And could you, Horst, tell me if you got anything working?
Thanks in advance.