diff --git a/extract-passwords-for-email.py b/extract-passwords-for-email.py
index 6bea4060b01dd03bcbb006a81589286b24709fd1..b7a62b109af717821a87848355b2bbdd5ea6abba 100644
--- a/extract-passwords-for-email.py
+++ b/extract-passwords-for-email.py
@@ -2,16 +2,22 @@
 # extract voter_id and passwords for a particular email address
 # may return many rows, if they all have the same email address
 #
-# python extract-passwords-for-email.py <email_address>
+# python extract-passwords-for-email.py <election_uuid> <email_address>
 #
 
 from django.core.management import setup_environ
-import settings, sys
+import settings, sys, csv
+from helios.models import *
 
 setup_environ(settings)
 
-email = sys.argv[1]
+election_uuid = sys.argv[1]
+email = sys.argv[2]
+
+csv_output = csv.writer(sys.stdout)
+
+voters = Election.objects.get(uuid=election_uuid).voter_set.filter(voter_email=email)
+
+for voter in voters:
+    csv_output.writerow([voter.voter_id, voter.voter_password])
 
-from helios.models import *
-print email
-print str(Election.objects.count())