Created
September 12, 2011 19:43
-
-
Save nikcub/1212184 to your computer and use it in GitHub Desktop.
Send email with Mail.app from command line script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
/usr/bin/osascript > /dev/null <<ASCPT | |
set stdinText to "$(cat | sed -e 's/\\/\\\\/g' -e 's/\"/\\\"/g')" | |
set recName to "Nik Cubrilovic" | |
set recAddr to "[email protected]" | |
set theSubject to "Email from standard input" | |
tell application "Mail" | |
set theMessage to make new outgoing message with properties {subject:theSubject, content:stdinText, visible:true} | |
tell theMessage | |
make new to recipient with properties {name:recName, address:recAddr} | |
send | |
end tell | |
end tell | |
ASCPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment