How to create an Automator “Mail Service” to compose the body of email from the content of a file

automatoremail

I would like to create a "Mail Service" with Mac Automator to create a New Message that automagically fills the body with the content of ascii file ~/Documents/MailBody.txt

I can select the file with "Find Finder Items", but not sure how to get its content to pass it as input to "New Mail Message". Note I want to add the content of the file to the body, not to attach the file itself.

Thanks a lot in advance.

Best Answer

The solution I have found is this: the first action in the workflow is "Run Shell Script" which just cat ~/Documents/MailBody.txt. This actions returns "text", which is passed as input to action "New Mail Message". It seems to work fine, even when the txt file has multiple lines.