Hello All!
I am looking for some guidance to send a bulk email from a CSV using an Apple Script. I exported a CSV that has a column of oweners and then the value is john doe doe@company.com. My goal is to take this list and send emails to each user with a standard reminder. I have been using this script, but cannot figure our for the life fo me how to adjust the values to read just doe@company.com
-- select the file
-- change this to a direct path if you prefer
set theFile to (choose file with prompt "Select the CSV file")
-- read the file contents:
set f to read theFile
-- break the file into paragraphs (c.f. rows)
repeat with row in (paragraphs of f)
-- parse the row into comma-delimited fields
set fields to parseCSV(row as text)
-- now you have your data:
set recipientAddress to item 1 of fields
set theSubject to item 2 of fields
set theContent to item 3 of fields
set recipientName to item 4 of fields
-- presumably you want to do something more with this data?
tell application "Mail"
set NewMail to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
set message signature of NewMail to signature "OG"
tell NewMail
make new to recipient with properties {name:recipientName, address:recipientAddress}
send
end tell
end tell
end repeat
on parseCSV(theText)
set {od, my text item delimiters} to {my text item delimiters, ","}
set parsedText to text items of theText
set my text item delimiters to od
return parsedText
end parseCSV
Thanks for any help!
Jared