Skip to content

Instantly share code, notes, and snippets.

@CatChen
Last active September 5, 2019 02:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CatChen/fe07ab39c7ea27d296e57838d7b5f1a4 to your computer and use it in GitHub Desktop.
Save CatChen/fe07ab39c7ea27d296e57838d7b5f1a4 to your computer and use it in GitHub Desktop.
set theRecipients to {{name:"Cat Chen", email:"catchen@catchen.me"}, {name:"Roli Chen", email:"roli@chen.cat"}, {name:"Elle Chen", email:"elle@chen.cat"}}
set theAttachment to (choose file with prompt "Select file for attachment...")
tell application "Mail"
repeat with theRecipient in theRecipients
set theMessage to make new outgoing message with properties {visible:true, subject:"Email with File Attachment", content:"Hi " & name of theRecipient & "," & linefeed & linefeed & "Check out the attachment in this email!" & linefeed & linefeed}
tell theMessage
make new to recipient at end of to recipients with properties {name:name of theRecipient, address:email of theRecipient}
make new attachment at end of last character of content with properties ¬
{file name:theAttachment}
end tell
delay 1
send theMessage
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment