I have a somewhat unique challenge: I have a CSV file that I need to extract text from and then send emails using that text. It's a one time issue and the emails need to be sent on the same day. Google has an option for something similar to this, but I need to send more than the daily quota of 100 emails. Using SMTP instead of the script uses a different quota, so I'll be able to send all of the emails I need to in one day if I go that route.
I've done some digging and the basic code to send the emails seems to be something like:
$ echo "This will go into the body of the mail." | mail -s "Subject" recipient@email.com
or
$ mail -s "Subject" recipient@email.com < /file/location/address.csv
Great so far, but I need it to extract the subject line from a CSV file and the text of the body, stopping when it hits the comma delimiter and then mark or remove the text in the source CSV file so it knows it already sent that email and doesn't repeat it. Finally, it needs to move onto the next row and repeat the process until it's gone through the entire CSV file.
Ideally, I should be able to execute it from terminal in OS X and watch the progress. (If possible, I'd like to include the 'sleep' command to introduce small pauses after it reaches each delimiter, to make the shell output intelligible instead of an endless stream of text.)
I have most of the basic snippets of code, but I'm not sure about how to extract the info from the CSV file and pipe it into what I already have. If anyone can point me in the right direction for that, I think I should be able to cobble it all together.
EDIT: If this is easier to do outside of bash, with another scripting language, I can probably cobble together everything but extracting the text and piping it into another command/output. Most languages have straightforward commands and libraries for that, so I should be able to Google and cannibalize the rest of the code. It's getting it from the CSV file into the emails that I have no idea how to do, despite repeated Google searches. (Also, if you think I was using the wrong search terms please feel free to suggest better ones.)