Attach unique attachment to email using apple script to send email to different users I'm new to apple script:
Does anyone have an example of using an AppleScript to send individual emails with unique attachments for each email using an excel list? (Lots of examples out there sending emails with an attachment, but no one seems to have done it with different attachments for each mail???)
Basically
I have an email list in excel which holds all email addresses and file names
and
a Folder with each excel file in it.
I want to send the email to user in email list and attach file to email and on a loop until complete. Each person should receive the same email but will have different file attached.
Can someone provide example please?
set theWorkbookFile to choose file with prompt &quot;Please select an Excel workbook file:&quot;
set theWorkbookName to name of (info for theWorkbookFile)
tell application &quot;Microsoft Excel&quot;
open theWorkbookFile
set theWorkbook to workbook theWorkbookName
set peremail to value of used range of active sheet
end tell
--This is the part that I am stuck on???--
tell application &quot;Finder&quot;
activate
set theAttachmentFile to every file of &quot;Macintosh HD:Users:j:Box:Email test:&quot;whose name contains (peremail as Unicode text) -- the attachment path
end tell
repeat with aRow in peremail
set {theEmail, theName} to aRow
tell application &quot;Mail&quot;
set newMessage to make new outgoing message with properties {sender:thesender, subject:&quot;Order&quot;}
tell newMessage
set content to &quot;XXXX&quot;
make new to recipient at end of to recipients with properties {name:theName, address:theEmail}
tell content of newMessage
            make new attachment with properties {file name:theAttachmentFile as alias} at after the last word of the last paragraph
            
        end tell
        delay 3
        
    end tell
    
end tell

end repeat