Shortcuts: can I get the body of a iOS Mail message?

I’d like to create a shortcut that takes a mail message, extracts text using a regular expression and then outputs it as either text with tabs to paste in a spreadsheet or directly into an Excel file. I can’t get past the first step. How do I get the body of a mail message into Shortcuts?

Select all the text and “share” it?

Mail is notoriously lacking a share sheet for emails themselves.

As best I can tell, you can’t get at the contents of an existing email message in Shortcuts, Scriptable, or Pythonista.

If you are using Gmail, you can open a particular message in Safari using a URL, as described here:

With Safari open to that page, you might be able to use the Run JavaScript action to extract the contents of the message. I don’t think you can do this all in a single shortcut, though, as the Run JavaScript action can only be used from the Share Sheet.

I’m pretty sure everything you want can be done via AppleScript, but that, of course, means you have to run it from a Mac.

This isn’t the most elegant method, but you can use the print to pdf trick in Mail app married with a simple shortcut that accepts PDF from sharesheet. This may suffice for you. Hope that helps — jay

Thanks all! I’ll look into the PDF trick.