Forked from youandhubris/AppleScript Mail Send.scpt
Created
February 8, 2023 19:25
-
-
Save dslusser/59a9f5c3b3ee7e3cd1144ddbbbd89163 to your computer and use it in GitHub Desktop.
AppleScript to send e-mail, using Apple's Mail, with multiple recipients, cc, bcc and attachments
This file contains hidden or 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 theFrom to "" | |
set theTos to {} | |
set theCcs to {} | |
set theBccs to {} | |
set theSubject to "" | |
set theContent to "" | |
set theSignature to "" | |
set theAttachments to {} | |
set theDelay to 1 | |
set theMessage to make new outgoing message with properties {sender:theFrom, subject:theSubject, content:theContent, visible:false} | |
tell theMessage | |
repeat with theTo in theTos | |
make new recipient at end of to recipients with properties {address:theTo} | |
end repeat | |
repeat with theCc in theCcs | |
make new cc recipient at end of cc recipients with properties {address:theCc} | |
end repeat | |
repeat with theBcc in theBccs | |
make new bcc recipient at end of bcc recipients with properties {address:theBcc} | |
end repeat | |
repeat with theAttachment in theAttachments | |
make new attachment with properties {file name:theAttachment as alias} at after last paragraph | |
delay theDelay | |
end repeat | |
end tell | |
# macOS 10.12+ know bug | |
# https://stackoverflow.com/questions/39860859/setting-message-signature-of-outgoing-message-using-applescript | |
# set message signature of theMessage to signature theSignature | |
send theMessage | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment