I have been trying this but something or the other is not working fine. The following is my script which I have put together after much searching around:
-- Set the starting time
set startTime to current date
set startTime to startTime + (1 * minutes)
-- Get the email data from the Numbers sheet
tell application "Numbers" to tell document "MailList" to tell sheet 1 to tell table 1
set emailData to value of every cell of range "A2:D2"
end tell
-- Choose the email account to send from
set senderEmail to "email@exampledomain.com" -- Replace with the email address of the desired account
-- Iterate through the email data and send emails
set emailCounter to 0
repeat with emailRow in emailData
-- Check if the daily email limit has been reached
if emailCounter ≥ 45 then exit repeat
-- Get the email details
set therecipient to item 1 of emailRow
set recipientName to item 2 of emailRow
set thesubject to item 3 of emailRow
set content to item 4 of emailRow
-- Delay until the next sending time
repeat until (current date) ≥ startTime
delay 1
end repeat
-- Compose the email message
set emailContent to "Dear " & recipientName & "," & return & return & content
-- Send the email
tell application "Mail"
set newEmail to make new outgoing message with properties {subject:thesubject, content:emailContent}
tell newEmail
make new to recipient with properties {address:therecipient}
send
end tell
end tell
-- Increment the email counter
set emailCounter to emailCounter + 1
-- Set the next sending time
set startTime to startTime + (1 * minutes) as date -- 1 minute interval
end repeat
I am trying to create an automated way to send 45 emails everyday, which are listed in an Apple Numbers sheet. I would like to just be able to click on the AppleScript and know the task is done. The next day, the next 45 emails would go...
Problems: 1- It won't open the Numbers file. Works only if Numbers File and Mail is open and running. 2- When all apps and files are open, it does work, but strangely in email field, subject and mail body, only one alphabet is inserted. 3- If I have, lets say, 90 contacts to email, how will it keep track of who has been sent an email already?
Not an expert at all on AppleScript. Some help would be much appreciated.