Skip to content
(1) Send emails with grades from a CSV file and attachments from a folder, using a template. (2) Pair people for conversations.
Haskell Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Emailer.hs
Hearts.hs
README.md
Utilities.hs
email.txt
hearts.txt
hearts_end.txt
hearts_old.txt
odd.txt
pass.txt
pass_end.txt
pass_old.txt
sample_script

README.md

Send emails with grades from a CSV file and attachments from a folder, using a template. Adapt to your needs.

Requirements

  • Haskell platform
    • You will need to cabal install several packages: parsec, cassava, MissingH.
    • For Hearts, you will also need bimap, random-shuffle, and graph-matchings.
  • Script works under cygwin. Modifications may be necessary for other shells.
    • Requires email. Do apt-cyg install email and follow instructions to configure email.
    • Look up the SMTP info from your email provider. Ex. for Princeton, see here. (Replace with smtp.princeton.edu for general Princeton email.)

Instructions

Emailing grades

  • Write an email and save it as email.txt. For fields that are customized, use a keyword (ex. NAME). (email.txt gives a sample.)

  • Customize Emailer.hs as desired.

    • It expects a CSV file with no header and with columns LAST NAME, FIRST NAME, ID, (HW GRADES), HW AVERAGE, EXAM, FINAL AVERAGE.
    • Customize it with which fields you want to replace, ex. NAME with name.
    • Put all the attachments with students' names in one directory.
  • Compile: ghc Emailer.

  • Run ./Emailer with arguments. See sample_script.

    ./Emailer "Subject" "from@domain" "cc@domain" "C:/dir/to/files/" "grades.csv" "email.txt" "@domain" "output_name"

  • Script will try to find attachment corresponding to each person. (Best to name the attachments LASTNAME_FIRSTNAME.pdf, for example.) For each attachment name it can't resolve, it will ask you to enter the file name.

  • Script produces one text file for each email.

  • Run the output file (default: email_grades). WARNING: This sends out all emails; you may want to check the text files first!

Heart-to-heart

This is a script for pairing people with conversation partners. The flags are:

  • -w week number (default: 1)
  • -c csv file (default: responses.csv)
  • -f from email (default: holdenl@princeton.edu)
  • -m match email (default: hearts.txt
  • -n no-match email, for people who can't make it this week (default: pass.txt)
  • -d odd-one-out email, for an unmatched person when there are an odd number of participants (default: odd.txt)
  • -o output file (default: output_<week number>.txt)
  • -q questions file (default: questions.txt)
  • -s output script (default: script_<week number>) (the no-match script has _n appended to it)
  • -i input data (default: data_<week number - 1>.txt)
  • -d output data (default: data_<week number>.txt)
  • -e file with people to exclude for this week (default: exclude_<week number>.txt) (a list of emails, one on each line)

NOTE: The CSV reader expects a newline at the end. If you have parsing errors, check that this is true.

Setup:

  • Compile: ghc Hearts.
  • Collect responses with a form (such as this), and download it as responses.csv. (See note above on CSV parsing.)
  • Put the email text in hearts.txt, pass.txt, and odd.txt. Put the questions in questions.txt.
  • Initialize data_0.txt with a list of pairs of ID's of people who already know each other (so they won't be matched), in quotes. The ID is the row number (the first person is 1). Example:
    "1","2"
    "3","4"
    
    
  • For week <k>, write the emails of people to be excluded in exclude_<k>.txt, each on a separate line.

Example (for week 2):

 # create emails
./Hearts -w2
 # sends emails for matches
./script_2
 # sends emails for unmatched
./script_2_n
You can’t perform that action at this time.