Skip to content

Code that automatically pairs a list of names/e-mails, assign Secret Santas, and send personalized e-mails to each player!

License

Notifications You must be signed in to change notification settings

nespinoza/secret-santa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

secret-santa

This code assumes you were assigned to take care of the pairing of a Secret Santa at your company/institution, and you are too lazy to:

  1. Pair the people.
  2. Send the e-mails to let people know who got who.

Of course, this code can easily be modified to send automatic notifications to you or someone every week (e.g., running the code as a cronjob), e-mail yourself when you want to know when that piece of code that is running on a screen is actually finished or, simply, to spam people about that awesome event you are planning and you want them to attend (yes; personalized e-mails are better at this job than just sending an entire e-mail chain to all your invitees).

Currently, the code works for google accounts only. Before using the code, you'll have to activate the 'Less secure apps' from your gmail account or you'll get an SMTP Authentication Error. I usually deactivate it when using the code, then activate it back again. You can do this from here: https://www.google.com/settings/security/lesssecureapps.

Dependencies

This code makes use of the following Python's libraries:

  • email
  • random
  • smtplib
  • yaml
  • json
  • ssl

All of them are already included in Python.

How to use it

  1. Modify the HTML code of the email body in the email.txt file.
  2. Modify the _config.yml file to add your Gmail credentials (mail/password):
# Configuration file
body: email.txt
list: emails.json
subject: "[Future Lab] Tu amigo secreto es..."
sender: "Equipo Future Lab"
email: [email protected]
password: XXXXXXXXX
  1. Modify the emails.json file to add the people that will be assigned. The format of this JSON file must be as follows:
[
   ...
   {
      "name": "Person N",
      "email": "[email protected]"
   },
   {
      "name": "Person N+1",
      "email": "[email protected]"
   },
   ...
]
  1. Finally, just run the main script:
$ python run.py

License

This software contains a MIT License.

Copyright (c) 2020 Nestor Espinoza, with contributions from Rodolfo Ferro & Ivan Gonzalez

About

Code that automatically pairs a list of names/e-mails, assign Secret Santas, and send personalized e-mails to each player!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages