Every year my friends and I typically have a little “Secret Santa” (we call it “Secret Satan”, but that’s neither here nor there) — you know, where you are randomly pick a person’s name out of a hat and it becomes your job to buy a present for said person.
In previous years it was always easier because we were able to meet up to do the hat-selection. The past two years have not been so easy, due to conflicting schedules and what-not. Last year’s solution was to get someone’s mom to send out the emails.
This year I opted for a PHP-based solution. If you’re thinking “THAT’S AMAZING”, you are correct, it is amazing. Because of the rush I was in to make it, it’s not as user-friendly as it should be. There’s two things you need to do to get this working out of the box:
- Edit the array containing names and emails. This is the most critical part.
- When you first run the script it will be in no-email mode, so you can preview the how the script might work (remember, it’s random …). Change the $noemail variable to false for it to send emails. You will NOT see who is paired up with who after debug mode is turned off.
It randomly pairs people up, making sure not to pair up the same person twice, or pairing the same person. Then it sounds out the emails! It’s just that easy (I hope).
Edit: this has been updated as of December 2009.

The script seems pretty good but the emails don’t work. Do u know whats wrong? Thanks!
Are you sure your server can send email?