I used to send small batches of mails to students of mine (inserting test results from a CSV file into each mail) with an AppleScript that controlled Apple Mail. However, I recently found that Apple Mail has a bug and formats messages incorrectly when controlled via AppleScript (see How to send an email with AppleScript, without the text being put in a blockquote). This caused the mails to often end up in spam folders...

Now I am looking for some alternative ways to send the mails.

I know there are online cloud services for mass mailings, but I don't feel comfortable uploading personal data to those and they seem to be mostly for marketing mails... Are there other options to send about 40 mails based on a CSV file? Not really looking for a list of concrete providers, but what general options there are, I guess.


2 Answers 2


I can think of two options you could look into:

Write your own

Since you already programmed in AppleScript, would you be fine writing larger programs in another scripting language? Languages like python would offer you a way to connect to a mail server and send the messages for you. At least if you are only sending plain text mails, this might be good enough. With more complex mails, I could imagine that formatting them properly is a bit more tricky...

Use a local desktop app

You could get an app that runs locally on your machine and processes your csv file to send out the mails. These apps act like a normal email client, so with this, you could keep using your standard email account and wouldn't have to worry about uploading your data to a cloud service.

At my previous job we used the app SerialMailer for this. Importing a CSV file and then sending out personalized messages to each entry. It worked really well for us, but I think there are also some other apps out there you could try.

  • Spent some time trying shell scripting, but then found out that the bulk mailer you suggested even supports personalising attachments... Didn't think of that at first but might come in really handy, so gonna go with that :)
    – powerpete
    Oct 24, 2023 at 17:21

Expanding on the concept from Send email from command line (macOS Monterey 12.3) which was linked to in a comment,

If your CSV file is simple, you can probably just loop over it in a shell script.


while IFS="," read -r email firstname lastname course grade; do
  # The lines after this one need to be indented by a tab
  mail -s "Your grade for $course" "$email" <<-\____here
    Hello $firstname $lastname!
    I am happy to tell you that you passed $course.
    Your grade will be $grade
    Prof. Power J. Pete
done <file.csv

(The tab indentation is for human legibility; you can remove the indentation and take out the - after << if you are having trouble with getting literal tabs in there. Unfortunately, Stack Exchange replaces them with spaces here.)

A complication is that some CSV dialects will aggressively add quotes around the values; you will then need to clean up the fields as you read them, or try to switch to a different delimiter (tab-separated values or TSV is often good for this. Then you need IFS=$'\t').

In case it's not obvious, the input would be a CSV file with the following data (and no header):

[email protected],Bob Q.,Student,Anthropology 101,B
[email protected],Jane W.,Pupil,Python Asynch and Threading,A
[email protected],Donald,Trump,Ethics 101,F

This crucially requires your Mac to already be configured to send email out of your organization. In some settings, this pesky detail can be the harder part; but many universities etc make this really easy as long as you are within their network or VPN. You just need to know the name of the outbound server (aka smarthost or relayhost, smtp.your.edu?); the linked question has an answer with more details about how to set up Postfix.

  • This is great, thanks a lot for the script. In my case the email setup doesn't work out of the box, but I'll dive a little deeper and try to figure that out with the help of the linked question. :-)
    – powerpete
    Oct 19, 2023 at 9:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .