sorry I didn't paste my piece of code but I don't know where to start... I'm talking about apple script. I've found some code to send emails and I would like to implement a script that does what I'm about to write. I have a folder that contains about 1000 pdf files that I have to send in groups of 20 at a time via email. I have a bit of confusion in my head but conceptually I think it can be done by counting all the files in the folder, then every 20 files I take the respective file names and set a variable with these names, including the path and I send the first email, then I proceed with the other 20 and so on until it has completed the number of files in the folder. Is there someone who can help me? A thousand thanks!! I am attaching the portion of code relating to sending via email...
I tried the given code and it works. it sends the email but i didn't check if it sends attachment
`
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
`