Created
June 12, 2019 10:07
-
-
Save BoyetDgte/396c7dc52f4d9681b9f618a8f154fc45 to your computer and use it in GitHub Desktop.
Apple script for emailing multiple accounts in Mac Mail
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
set {firstName, eAddress} to getData() | |
repeat with i from 1 to count firstName | |
tell application "Mail" | |
activate | |
set mymail to make new outgoing message at the beginning of outgoing messages with properties {subject:"Great new! We are now offering Radio Mobile Apps for Android and iOS here at Internet Radio Cast on VPS"} | |
tell mymail | |
make new to recipient at beginning of to recipients with properties {address:item i of eAddress} | |
delay 5 | |
set content to "Hi " & item i of firstName & " | |
We are excited to inform you guys that we are now offering radio mobile apps for Android and iOS at $69 and $99 respectively for a one time fee only. | |
Please visit our site for more info! https://www.radiocastvps.com | |
Thanks, | |
Ernesto | |
Internet Radio Cast on VPS | |
" | |
end tell | |
--show message window (otherwise it's hidden) | |
set visible of mymail to true | |
--bring Mail to front | |
activate | |
send mymail | |
end tell | |
end repeat | |
on getData() | |
set colA to {} | |
set colB to {} | |
tell application "Microsoft Excel" | |
activate | |
tell active sheet | |
set lastRow to first row index of (get end (last cell of column 1) direction toward the top) | |
repeat with i from 3 to lastRow | |
set end of colA to (value of range ("A" & i)) | |
set end of colB to (value of range ("B" & i)) | |
end repeat | |
end tell | |
end tell | |
return {colA, colB} | |
end getData |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to have this add an attachment? I have found this works brilliantly except when I try to add an attachment; what I included above "set content" is make new attachment with properties {{file name, "Macintosh HD:User:Desktop:file name)}
but this screws up the rest of the script. any ideas?