Take a look at the two photos above. Do you notice any differences between them? The image on the left is just an ordinary .jpeg file. While the photo on the right has a secret message encoded into it: The first 5 people to email kunal@sendgrid.com with their… To get the rest of that message make sure to download that image and follow the instructions below on how to do decode.

This also works on .wav files as well. Take a listen to both of them and see if you can figure out which one has the secret message encoded into it. The first .wav file has the same encoded message as the image above.

Try It Out

Decode a Message

  1. Send an email to sendgrid@kunalbatra.bymail.in
  2. Make sure you set the subject to decode
  3. Make sure to attach the file you want decoded

You will get back an email with the extracted message in the body.

Encode a Message

  1. Send an email to sendgrid@kunalbatra.bymail.in
  2. Make sure you set the subject to encode
  3. Make sure to include a body. We use this and encode it into your attached file
  4. Attach either a .wav file or an image file(.jpg only)

How to Encode and Decode

Using the SendGrid Parse Webhook, we can write code that gets attachments and other parts of the email. In this case, I take the body and encode it into the attachment using a Unix program called Steghide. It uses a concept of security called Steganography.

If you attached a .jpg file, it will modify the pixels to store its data. Otherwise, if you attached a .wav file, it will convert the text into audio samples and embed that into your file. It’s a really cool way of hiding information in plain sight.

This hack was written in the Go Programming language. It uses our official Go library to send outgoing email and the Incoming Parse Webhook to receive incoming email into our application. You can check out the source code on GitHub to create your own secret message apps.

If you have any questions, feel free to tweet at me @kunal732.

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