You are browsing as a guest. Sign up (or log in) to start making projects!

AutoSanta: A Secret-Santa Automated Email System

  • 10 Devlogs
  • 9 Total hours

I am building a Secret-Santa Automated Email System. Secret Santa is a fun way to spread Christmas cheer, however methods like the old "hat" draw just don't do it anymore. People swapping slips, or even getting their own name! Where's the integrity and spirit in that? Want an easy, smooth, fair way to tell everyone who's giving who a present? Meet AutoSanta. An automated, secure way that distributes individual, unique emails to people saying who they have to give a present to. This works by inserting the participants name and email into the code and sit back and watch the code do the rest.

Open comments for this post

1h 35m 25s logged

Did some last minute tweaks to the UI, made it look all festive and Christmassy.

Once I was happy with it, I tried updating it, but the Nest deployment thingy wouldn’t work/update. It sucked the life out of me!

Then I went on Vercel and put it on there (that’s the only other 1 Stardance accepts, because Github pages doesn’t support backend coding like python)

After some more head banging, it works! It is live, working and can send emails!

This is prolly my last devlog to shipping

PS. also updated README to include relevant, upto date information after recent changes

I worked really hard on it than any other 1, cuz the mission said i needed a good README, YIKES!

0
0
3
Ship #1 Pending review

I made a cloud-deployed Secret Santa generator using a Python Flask backend and an HTML/CSS frontend. It shuffles participants and emails custom HTML holiday assignment cards directly to their inboxes.

Something that was a challenge was building a defensive validation loop to stop players from accidentally drawing their own names, and fixing case-sensitivity folder issues (Templates vs templates) when deploying onto the Linux cloud server (Render).

Something that I am proud of is making custom HTML cards directly to user inboxes instead of boring plain text, and keeping the mail server totally secure by hiding app passwords using Environment Variables (.env).

It is 100% live on the web! Just open the Render link, add a few email addresses you own, set a budget/date, and hit send. Give it a few seconds to process and then check your inboxes for your assignments (it actually works!)

Try project → See source code →
Open comments for this post

1h 11m 5s logged

Ok guys just finished on the custom email, it looks SO MUCH better than before. I genuinely did not know you could put html code inside of an email body and using MIMETEXT, you can put it in the email and it will actually work!! I am very proud of this, I think now, I will finally make the README.

0
0
2
Open comments for this post

32m 59s logged

Just worked on improving this, UI looks fairly OK. But 1 thing I realised is the emails sent are fairly basic, I will now try to improve the look as well as message conveyed in the email. It’s looking pretty good!! Nearly done, just a few cosmetic touches and nearly ready to ship

0
0
1
Open comments for this post

34m 57s logged

People, I just finished migrating from Resend back to the SMTP gmail server. It now says its from the secretsanta generator now. Next up: I think I will add some customisation features, like a date or budget, the customer has more freedom over their choice, (maybe even a theme other than secret santa) Anything BUT the boring README

0
0
5
Open comments for this post

37m 35s logged

Ok guys, just added the loading circle, fairly easy, BUT… however… getting the email system of Resend may take a bit more work. I first of all need a domain, subdomains, submit DNS records. That is too messy, as I don’t even own a domain and plus, that is way too much work, very unnecessary, so I will just make a new gmail account call it [email protected], get the 16 digit App key, rework some code (bit more than some) because I have to delete the original resend code, and then fix the original code I had for the gmail. RAAAAAAR. and of course, the readme

0
0
3
Open comments for this post

2h 0m 46s logged

Engineering Devlog #2: Moving to the Web & Dynamic Inputs

Objective / Goal

So this session today was about upgrading the project from a command-line Python script into a fully functional web application using Flask. This allows unfamiliar users easily enter participants names and emails via web interface.

Progress Made

  • I created an index.html for the actual website. I just wrote all the css code inside the actual html code as the code wasn’t that long that it needed its own css file.
  • I built a dynamic form with an ‘Add person’ button as well as a ‘Remove person’ button (just an X).
  • Additionally, I removed the hardcoded .env credentials and replaced with the website asking for the user’s email and 16-digit App password (so we don’t have to use mine). These are all temporary variables meaning they immediately get cleared from memory after deploying.

Roadblocks Encountered & Resolutions

  • There were quite a few bugs and errors, but I realised they were just silly mistakes like syntax errors and files nesting in the wrong places.
  • For example, I had some TypeError bugs because my send_email function was missing arguments after the update, and a TemplateNotFound error because my HTML file wasn’t sitting inside the correct folder structure that Flask looks for.
  • I fixed them by making sure the file paths matched what Flask needed and ensuring all arguments were passed correctly in my Python loops.

What’s next

  • I am going to be adding a loading screen for when the audience clicks the submit button because the screen just stays kinda frozen and its hard to tell if its loading.
  • Also I am going to find a workaround to not have to get people to put in their 16-digit App password just for a Secret Santa Email system. I am planning on switching to third party APIs like Resend or SendGrid.
0
0
4
Open comments for this post

1h 2m 3s logged

Devlog: Automated Secret Santa Email System

Language: Python
Tools: VS Code, GitHub


Project Overview and Objective

I just made the project, it works! This project just required smtplib and ssl to establish a connection to Gmails servers, as well as python-dotenv to securely manage the sender’s email credentials without hardcoding passwords. As for the proper details on how this works, I will be including it in my README (that I’ve yet to make).


Challenges and Technical Roadblocks

There were a few bugs honestly. Here is what I ran into and how I solved them:

1. Environment Setup and Security Blocks

  • The Problem: Windows initially wouldn’t recognize the pip command to install libraries, and standard email passwords were blocked by Gmail’s modern security protocols.
  • The Solution: After some googling and reading forums, I realised I needed to bypass the Windows PATH issue by using python -m pip install. To fix the security block, I enabled 2-Step Verification on my Google account and generated a unique 16-character App Password specifically for this script. (Which I cannot show to anyone, you will not see it in my Github page).

2. Backend Shuffling Logic Error

  • The Problem: Another problem with the backend logic, I used while loop to shuffle and assign the peoples names, something I realised was that it would delete items from the list using .pop(0) while shuffling inside the loop. This caused a logic error where people could be assigned to themselves, or multiple people could be assigned the same target.
  • The Solution: In order to fix this I restructured the logic to create a separate clone of the participants list using .copy() and then implemented a while True loop that shuffles the target list and checks it. If anyone is matched with themselves, it automatically reshuffles before sending any emails.

Code Architecture

See the code below:

while True:
    random.shuffle(targets)
    matched_self = False
    for i in range(len(participants)):
        if participants[i][0] == targets[i][0]:
            matched_self = True
            break
    if not matched_self:
        break

So what’s next?

Just adding the README, testing to see of the project can handle variations or emails, (icloud, yahoo.com, microsoft, maybe like work or school organisations.)

And also adding an inbuilt condition to see if the email is valid, the program should see if an email is actually real. Not just try and send an email to someone like @gail.com or some other typo

0
0
1

Followers

Loading…