andraz / SendGridRawEmailtoJSON / 0.1.4

Raw Email to JSON is an algorithm that takes in raw MIME e-mail and outputs simple JSON with all the components of the email.

Note: There is an issue with iCloud messages.


  • (Required): Raw MIME email in text/plain format.


Output is in JSON format:

  • attachments (list of arrays)

               - content (string): base64(utf-8) encoded attachment file.

               - filename (string): attachment file name.

               - type (string): attachment file type in MIME format. (example: text/plain)

  • from (string): full sender name. (example: John Doe <>)
  • fromaddress (string): sender's e-mail address.
  • fromname (string): sender's name. 
  • headers (list of arrays) 

               - name (string): header name. (example: X-Priority)

               - content (string): header content. (example: 3)

  • html (string): HTML content of the message.
  • html_type (string): Outputs MIME type. (example: text/html)
  • inline(list of arrays)

               - content (string): base64(utf-8) encoded inline file.

               - filename (string): inline file name. 

               - type (string): attachment file type in MIME format. (example: text/plain)

               - cid (string): inline content id.

  • subject (string): subject of the message.
  • text (string): plain text version of the message (if included).
  • text_type (string): Outputs MIME format of the text.
  • to (string): full recipient name. (example: Jane Doe <>)
  • toaddress (string): recipient's e-mail address.
  • toname (string): recipient's name.