Created
October 8, 2012 04:22
-
-
Save Moligaloo/3850710 to your computer and use it in GitHub Desktop.
Send mail with attachment and signature via AppleScript in OS X
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
tell application "Mail" | |
set theSubject to "Subject" -- the subject | |
set theContent to "Content" -- the content | |
set theAddress to "[email protected]" -- the receiver | |
set theSignatureName to "signature_name"-- the signature name | |
set theAttachmentFile to "Macintosh HD:Users:moligaloo:Downloads:attachment.pdf" -- the attachment path | |
set msg to make new outgoing message with properties {subject: theSubject, content: theContent, visible:true} | |
tell msg to make new to recipient at end of every to recipient with properties {address:theAddress} | |
tell msg to make new attachment with properties {file name:theAttachmentFile as alias} | |
set message signature of msg to signature theSignatureName | |
send msg | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Definitely needed the delay command. I used a
delay 5
just in case things are going slow. Put it right before send command. I skipped using the signature and added it to the content itself.