Skip to content

Instantly share code, notes, and snippets.

@nikcub
nikcub / mails.sh
Created September 12, 2011 19:43
Send email with Mail.app from command line script
#!/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"
@nikcub
nikcub / mails.sh
Created September 12, 2011 19:40
send email with mail.app via terminal
#!/bin/sh
/usr/bin/osascript > /dev/null <<ASCPT
set stdinText to "$(cat | sed -e 's/\\/\\\\/g' -e 's/\"/\\\"/g')"
set recipientName to "John Doe"
set recipientAddress to "[email protected]"
set theSubject to "Email from standard input"
set theContent to "This email was created and sent using AppleScript!"
tell application "Mail"