I have Automator running a shell script that ends with cat "tempfile.txt"
. The cat
command should output the contents of tempfile.txt
. The file tempfile.txt
contains just the following three paragraphs over five lines:
1st paragraph Lorem
2nd paragraph Lorem ipsum
3rd paragraph Ut enim
I have this chained in Automator to the "New Mail Message" action. The instructions for this action say that "If text is received from a previous action, the text is appended to the message."
The expected behavior is therefore that the body of the email message contains those three paragraphs. Instead, it contains only the third—shown here:
Below is the relevant part of the workflow. In it we can see in the Results for the shell script that all three paragraphs are being passed to the "New Mail Action." Why does this not put all of the input text file into the message body?
Update (further info): If I swap in the "Create New Outlook Mail Message" action in place of the Mail.app action, all three paragraphs are successfully passed to the body of the new message in Outlook. However, they are passed without line breaks.
Best Answer
It looks like there may be a bug in New Mail Message action in Automator. If you are interested in an AppleScript workaround, where the output of the Run Shell Script action is formed into the content of the new mail message using AppleScript code to create a new mail message, here's an example workaround.
In place of the New Mail Message action use a Run AppleScript action, after the Run Shell Script action, with the following example AppleScript code:
This creates a new message that looks like the following example image.
If you need too, you can add additional properties, as in this example AppleScript code:
Obviously, you'll need to change the value of the additional properties, and or add more properties then shown, to fit your needs. You can look in Mail's AppleScript Dictionary in Script Editor for additional applicable properties.
This creates a new message that looks like the following example image.