Inbound Parse Attachments: Understanding What You Need to Know

Mastering Inbound Parse Attachments At SendGrid

At SendGrid, we live and breathe emails! Understanding how we process attachments via our Inbound Parse Webhook empowers our customers to send and receive emails with confidence.

Here are the key points you need to keep in mind:

  • MIME standards dictate whether specific content types are considered as attachments or part of the message.
  • .eml files are parsed based on these MIME standards - if there's an attachment within them, we'll capture it!
  • Various Content-Types can influence how an email client, like Gmail, interprets your attachment. This information also directs SendGrid on how to process that content as additional MIME and scan for any embedded attachments.
  • If no attachments are found in the .eml file, then no attachments will be included in the post.

Analyzing How Content Types Operate

One topic that often arises revolves around handling various `Content-Types`. This component plays a vital role when we parse out contents from an email body against leaving them intact.


Let us go through this process in detail:

The mime type (`Content-Type`) in an HTTP header notifies the recipient of what type of content is being sent. When dealing with emails and more specifically `.eml` or `.msg` files, `Content-Type` becomes pivotal.


Here's why:

For instance 'message/rfc822', often used with `.eml` files tells us that it contains additional MIME entities (like another email). As per standard practice at SendGrid, such a `Content-Type` prompts us to delve deep into the file exploring for other embeddable entities (like other nested emails) or potential stand-alone attachments. So instead of treating this whole `.eml` file as an attachment, we try to extract valuable bits from it to offer more granular information.

Contrast this with another `Content-Type`: let's say `text/plain` or `text/html`, SendGrid doesn't seek extra entities from these kinds of content. Instead, we consider these parts as part of the email body.

In some instances, a sender might use application/octet-stream while sending through SendGrid which indicates arbitrary binary data. This cannot really be parsed, so it arrives as an outright attachment in the post.


What about .msg files?

Put simply; they work like a charm!

Our tests show that .msg files are successfully handled as attachments and sent to your Inbound Parse Webhook, regardless of whether 'send raw' is checked.

One important detail: When a sender uses text/rfc822 as Content-Type, don't expect it to go through as an attachment. This type is often included in the body post instead!


Q&A section:

Q: What happens when I attach an '.eml' file?

A: Our system will try to parse it according to MIME standards and include any found attachment within it.


Q: Are my '.eml' attachments getting dropped?

A: No! They get processed according to MIME standards. If there aren't any usable attachments inside, nothing posts as an attachment for that file based on its sent Content-Type.


Q: Can I check my attached '.eml' Files at SendGrid's side?

A: Currently, this isn't possible. However, you can handle how you send these '.eml' files concerning their Content-Type.


Q: What about the sending of '.msg' Files?
A: '.msg' files work brilliantly! Our testing shows that they successfully attach and post to the Inbound Parse Webhook. So, keep 'em coming!


One Final Tip:

Remember to transmit '.msg' files in their original format instead of converting them to '.eml'. Trust us; it works like a charm!


Need more assistance?

We encourage you to reach out. Email can be confusing at times but fret not! SendGrid is here for you. Our team of experts always stands ready and eager to assist our customers with any queries or challenges they might face.

Let's make something great together! Reach out - we're stoked to help you master our feature-rich service!

Have more questions? Submit a request