We Are Hiring

How to Hide Text in Email Attachments


Posted on

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.


Meet Kunal, Developer Evangelist at-large for SendGrid and home-grown New Jersey hacker. He previously ran General Machines, which developed Deaftel - a phone service for the deaf that converts voice to text and text back into voice over a phone call. Since March 2013, Kunal has been working as a Developer Evangelist at SendGrid, helping enable developers to get the tools and resources they need to make awesome, creative stuff.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>