I am trying to run an AppleScript that sends emails through Apple Mail. It appears to be working properly, however I am seeing an error when I run the script.
This is the error I am seeing:
error "Can’t get text item 1 of \"\"." number -1728 from text item 1 of ""
This is my script:
set csv to read "/Users/Username/Documents/file.csv" as «class utf8»
set text item delimiters to ","
repeat with l in paragraphs of csv
tell application "Mail"
tell (make new outgoing message)
set subject to "subject"
set content to "content"
make new to recipient at end of to recipients with properties {address:text
item 1 of l}
send
end tell
end tell
end repeat
This is my CSV:
email1@gmail.com
email2@gmail.com
Any ideas on what I'm doing wrong? Thank you!