Many of you have have probably participated in X-Mas Gift Exchanges. If not, we should solve that! Here at SendGrid, we use Elfster and it works great. My friends and I have been doing an alcohol exchange recently.

I thought this was a simple problem to hack on and use some of the SendGrid features. So I did! I’ll try to explain all the steps that I took to create our exchange system.

First, I created a simple transactional template in SendGird’s Template Engine. Yes, the content is in Spanish 🙂

Notice that I have #recipient# in the content. That’s because I will be using Substitutions from the SMTP API.

Afterwards, I wrote very simple Python code using the sendgrid-python library. Here it is:

I want to highlight this specific line:

I don’t want my buddies to see who I’ve emailed, I wanted them to think I wrote individual emails. Using the SMTP API and specifying my recipients there, I get a carbon copy of each email delivered to each of them.

So there you have it! A simple secret santa using SendGrid! Happy Holidays!

SendGrid Team
Expert advice and insight about all things email including best practices tips, examples, and advice for marketers, developers, and everyone in between.