andraz

andraz / SendGridRawEmailtoJSON / 0.1.4

Raw Email to JSON

1 Credit Royalty API Calls - 49
email, sendgrid, parse, json, mailgun, mail
Language
Python 3.x
Permissions
The Algorithm Platform License is the set of terms that are stated in the Software License section of the Algorithmia Application Developer and API License Agreement. It is intended to allow users to reserve as many rights as possible without limiting Algorithmia's ability to run it as a service. Learn More

Run an Example

Input
Output
{
  "attachments": [],
  "from": "Jane Doe <sender@example.com>",
  "fromaddress": "sender@example.com",
  "fromname": "Jane Doe",
  "headers": [
    {
      "content": "example@example.com",
      "name": "Delivered-To"
    },
    {
      "content": "by 10.176.10.15 with SMTP id q15csp267918uah;        Thu, 22 Jun 2017 08:56:00 -0700 (PDT)",
      "name": "Received"
    },
    {
      "content": "by 0.0.0.0 with SMTP id example.1.1.2.2.3.3;        Thu, 22 Jun 2017 08:56:00 -0700 (PDT)",
      "name": "X-Received"
    },
    {
      "content": "<sender@example.com>",
      "name": "Return-Path"
    },
    {
      "content": "from mail.example.com (mail.example.com. [123.456.789.123])        by mail56.example.com with ESMTPS id fg695h5f9h549vg4hb98f        for <example@example.com>        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);        Thu, 22 Jun 2017 08:56:00 -0700 (PDT)",
      "name": "Received"
    },
    {
      "content": "pass (examole.com: domain of sender@example.com designates 0.0.0.0 as permitted sender) client-ip=0.0.0.0;",
      "name": "Received-SPF"
    },
    {
      "content": "1.0",
      "name": "MIME-Version"
    },
    {
      "content": "John Doe <example@example.com>",
      "name": "To"
    },
    {
      "content": "Jane Doe <sender@example.com>",
      "name": "From"
    },
    {
      "content": "Test Subject",
      "name": "Subject"
    },
    {
      "content": "Thu, 22 Jun 2017 17:55:56 +0200",
      "name": "Date"
    },
    {
      "content": "normal",
      "name": "Importance"
    },
    {
      "content": "3",
      "name": "X-Priority"
    },
    {
      "content": "multipart/alternative; boundary=\"_A324B2F8-13BF-4A72-8863-D9530242013B_\"",
      "name": "Content-Type"
    },
    {
      "content": "<20170622155558.CEEF71420B83@hnode1.korenc.eu>",
      "name": "Message-Id"
    }
  ],
  "html": "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:w=\"urn:schemas-microsoft-com:office:word\" xmlns:m=\"http://schemas.microsoft.com/office/2004/12/omml\" xmlns=\"http://www.w3.org/TR/REC-html40\"><head><meta http-equiv=Content-Type content=\"text/html; charset=utf-8\"><meta name=Generator content=\"Microsoft Word 15 (filtered medium)\"><style><!--\r\n/* Font Definitions */\r\n@font-face\r\n\t{font-family:\"Cambria Math\";\r\n\tpanose-1:2 4 5 3 5 4 6 3 2 4;}\r\n@font-face\r\n\t{font-family:Calibri;\r\n\tpanose-1:2 15 5 2 2 2 4 3 2 4;}\r\n/* Style Definitions */\r\np.MsoNormal, li.MsoNormal, div.MsoNormal\r\n\t{margin:0cm;\r\n\tmargin-bottom:.0001pt;\r\n\tfont-size:11.0pt;\r\n\tfont-family:\"Calibri\",sans-serif;}\r\na:link, span.MsoHyperlink\r\n\t{mso-style-priority:99;\r\n\tcolor:blue;\r\n\ttext-decoration:underline;}\r\na:visited, span.MsoHyperlinkFollowed\r\n\t{mso-style-priority:99;\r\n\tcolor:#954F72;\r\n\ttext-decoration:underline;}\r\n.MsoChpDefault\r\n\t{mso-style-type:export-only;}\r\n@page WordSection1\r\n\t{size:612.0pt 792.0pt;\r\n\tmargin:70.85pt 70.85pt 70.85pt 70.85pt;}\r\ndiv.WordSection1\r\n\t{page:WordSection1;}\r\n--></style></head><body lang=SL link=blue vlink=\"#954F72\"><div class=WordSection1><p class=MsoNormal>Is this a test?<o:p></o:p></p></div></body></html>",
  "html_type": "text/html",
  "inline": [],
  "subject": "Test Subject",
  "text": "Is this a test?\r\n",
  "text_type": "text/plain",
  "to": "John Doe <example@example.com>",
  "toaddress": "example@example.com",
  "toname": "John Doe"
}

Install and Use

Install

Install the Algorithmia CLI client by running:

curl -sSLf https://algorithmia.com/install.sh | sh

Then authenticate by running:

algo auth
# Enter API Key: YOUR_API_KEY
CLI Install Docs

Use



algo run andraz/SendGridRawEmailtoJSON/0.1.4 -d '"Delivered-To: example@example.com\r\nReceived: by 10.176.10.15 with SMTP id q15csp267918uah;\r\n        Thu, 22 Jun 2017 08:56:00 -0700 (PDT)\r\nX-Received: by 0.0.0.0 with SMTP id example.1.1.2.2.3.3;\r\n        Thu, 22 Jun 2017 08:56:00 -0700 (PDT)\r\nReturn-Path: <sender@example.com>\r\nReceived: from mail.example.com (mail.example.com. [123.456.789.123])\r\n        by mail56.example.com with ESMTPS id fg695h5f9h549vg4hb98f\r\n        for <example@example.com>\r\n        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r\n        Thu, 22 Jun 2017 08:56:00 -0700 (PDT)\r\nReceived-SPF: pass (examole.com: domain of sender@example.com designates 0.0.0.0 as permitted sender) client-ip=0.0.0.0;\r\nMIME-Version: 1.0\r\nTo: \"John Doe\" <example@example.com>\r\nFrom: \"Jane Doe\" <sender@example.com>\r\nSubject: Test Subject\r\nDate: Thu, 22 Jun 2017 17:55:56 +0200\r\nImportance: normal\r\nX-Priority: 3\r\nContent-Type: multipart/alternative; boundary=\"_A324B2F8-13BF-4A72-8863-D9530242013B_\"\r\nMessage-Id: <20170622155558.CEEF71420B83@hnode1.korenc.eu>\r\n\r\n--_A324B2F8-13BF-4A72-8863-D9530242013B_\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Type: text/plain; charset=\"utf-8\"\r\n\r\nIs this a test?\r\n\r\n--_A324B2F8-13BF-4A72-8863-D9530242013B_\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Type: text/html; charset=\"utf-8\"\r\n\r\n<html xmlns:o=3D\"urn:schemas-microsoft-com:office:office\" xmlns:w=3D\"urn:sc=\r\nhemas-microsoft-com:office:word\" xmlns:m=3D\"http://schemas.microsoft.com/of=\r\nfice/2004/12/omml\" xmlns=3D\"http://www.w3.org/TR/REC-html40\"><head><meta ht=\r\ntp-equiv=3DContent-Type content=3D\"text/html; charset=3Dutf-8\"><meta name=\r\n=3DGenerator content=3D\"Microsoft Word 15 (filtered medium)\"><style><!--\r\n/* Font Definitions */\r\n@font-face\r\n=09{font-family:\"Cambria Math\";\r\n=09panose-1:2 4 5 3 5 4 6 3 2 4;}\r\n@font-face\r\n=09{font-family:Calibri;\r\n=09panose-1:2 15 5 2 2 2 4 3 2 4;}\r\n/* Style Definitions */\r\np.MsoNormal, li.MsoNormal, div.MsoNormal\r\n=09{margin:0cm;\r\n=09margin-bottom:.0001pt;\r\n=09font-size:11.0pt;\r\n=09font-family:\"Calibri\",sans-serif;}\r\na:link, span.MsoHyperlink\r\n=09{mso-style-priority:99;\r\n=09color:blue;\r\n=09text-decoration:underline;}\r\na:visited, span.MsoHyperlinkFollowed\r\n=09{mso-style-priority:99;\r\n=09color:#954F72;\r\n=09text-decoration:underline;}\r\n.MsoChpDefault\r\n=09{mso-style-type:export-only;}\r\n@page WordSection1\r\n=09{size:612.0pt 792.0pt;\r\n=09margin:70.85pt 70.85pt 70.85pt 70.85pt;}\r\ndiv.WordSection1\r\n=09{page:WordSection1;}\r\n--></style></head><body lang=3DSL link=3Dblue vlink=3D\"#954F72\"><div class=\r\n=3DWordSection1><p class=3DMsoNormal>Is this a test?<o:p></o:p></p></div></=\r\nbody></html>\r\n--_A324B2F8-13BF-4A72-8863-D9530242013B_--"' --timeout 300
  
CLI Docs