Understanding Inbound Parse Attachments

Overview

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.

 

What You Need To Know

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.

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.

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!

Frequently Asked Questions

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

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

Are my '.eml' attachments getting dropped?

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.

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

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

 

What about the sending of '.msg' Files?

'.msg' files work brilliantly! Our testing shows that they successfully attach and post to the Inbound Parse Webhook. So, keep 'em coming!

Additional Information

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

Have more questions? Submit a request