Skip to content

A CLI tool to generate Secret Santa matches and notify the participants via email.

License

Notifications You must be signed in to change notification settings

kkoutsilis/SSMG

Repository files navigation

SSMG

CI

SSMG (Secret Santa Match Generator) is a simple CLI tool written in Go. It reads a JSON file containing Secret Santa participants, generates the matches, and sends an email to each participant with their assigned match.

Motivation

Picture this: my friends and I, spread across the globe, were scheming up a festive get-together complete with a sprinkle of Secret Santa enchantment. Now, the catch? Our scattered geography made the classic match-making puzzle a bit tricky. Sure, there are online platforms for such scenarios, but most demanded user accounts—a hoop I'd rather not jump through. And then there's the whole sharing-emails-with-apps deal, not my cup of cocoa. So, cue my weekend project: a sleek CLI tool tailored to weave our Secret Santa magic, no strings attached. Here's to coding our way to holiday cheer! 🌐🎄✨

Disclaimer
I am not so familiar with GO so the code probably needs cleaning and improvements, but hey, it works!

Usage

To use SSMG, you need to have go installed, clone the repo locally, provide a JSON file containing the participant data and some environment variables to be used to send the emails.

Environment Variables

  • EMAIL_HOST: The email host, for example smtp.gmail.com for gmail.

  • EMAIL_PORT: The email port, tipically 583 for smtp.

  • EMAIL_FROM: The email sender, the one pulling the strings.

  • EMAIL_USER: The email account's username, usually your email itself.

  • EMAIL_PASSWORD: The passwowrd for the given email account.

Note: Gmail does not allow plain password login and instead uses app passwords, which is more secure as well. You can learn how to create and use app passwords here.

Input File Format

[
  {
    "name": "participant1",
    "email": "participant@test.com"
  },
  {
    "name": "participant2",
    "email": "participant2@test.com"
  }
]

Run

go run main.go --file my_data.json

or by using the binary

 go build --ldflags "-s -w" ssmg
./ssmg --file my_data.json

Note: If file flag is not provided, the program will default to data.json.

Testing Emails

There is a docker compose file that spins up a MailHog service that can be used for testing the emails. Simply docker compose up to use the testing (MailHoghttps://github.com/mailhog/MailHog) service and set the environment variables to

export EMAIL_HOST=localhost
export EMAIL_PORT=1025
export EMAIL_FROM=test@example.org
export EMAIL_USER=””
export EMAIL_PASSWORD=””

You can access the MailHog UI at localhost:8025

About

A CLI tool to generate Secret Santa matches and notify the participants via email.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published