Parsing multipart/form-data from SendGrid inbound mail parse

Options
Hey guys, I'm testing out SendGrid's inbound mail parse with a test title, test body texts, and also 2 attachments.

When the email hits SendGrid, they send over a multipart/form-data that is separated by boundaries to an end point that I set up in Xano. How do I parse this request body into a useful object that I can use to extract the information I need (Title, body text, sender, date, raw attachment resource portion to be constructed back into the original file format, attachment name, attachment mime type, size, etc etc).

Appreciate your insights! I have posted the request body from SendGrid below:

--xYzZY
Content-Disposition: form-data; name="headers"

Received: by mx0063p1iad2.sendgrid.net with SMTP id 7fnlZANC8J Fri, 05 Aug 2022 02:07:24 +0000 (UTC)
Received: from mail-ej1-f45.google.com (unknown [209.85.218.45]) by mx0063p1iad2.sendgrid.net (Postfix) with ESMTPS id 68C558212E7 for ; Fri, 5 Aug 2022 02:07:24 +0000 (UTC)
Received: by mail-ej1-f45.google.com with SMTP id i14so2521798ejg.6 for ; Thu, 04 Aug 2022 19:07:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=my.domain; s=google; h=to:subject:message-id:date:from:mime-version:from:to:cc; bh=d2dEfPESK+37xE8I0wSBTV2WkV1Vvbnj4B/wWnwRNrU=; b=dCMSSXEOib6ulzlIG4YSxMXa4HGD/TVqvR9iR1QI+BqxcSn28BxGumR44ZaMCf4Jj2 lnmvIdtF5bzUFtroJ55dpNeJsMkabOOC4Y1wxXuF6rEb/c2crbFp/fCTW1YaTTfBiGsZ 4w2Iwyi3QIXiQFSYN9LOg8Ghv5JF/7i5+yN7YqFrnZ10UabEP4AUNbg7RUGV9rm/Mfmy UCxepCx5RCnha60YTbA43RGYplgLnbSELCfTWaCFOpobrTdSaPW+l3GNLCg/MWiVcLUP +zT7NbLH/rWN13iDyP2qd4viat4ZUGdEdQU68admdbgiqp5dcmZxM0HT0XY2sXahu2ED bomg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc; bh=d2dEfPESK+37xE8I0wSBTV2WkV1Vvbnj4B/wWnwRNrU=; b=44c6Uv8gZGRPQfLZ0I2gtuW0bLB/QR1FblG5RypUkO9cOCU47bgLtJuaFsuj4RIrq0 B8LvrWabrNFqFEr+EcxwLh15NmpMxodJkSsLvcZDdzZB4IVNZec1B9PkS2Kfl1ZueW4Z RDBp96H/Xq3yo+vt7nO7sp10ihH4sDsptITNZxXnD5KShUVl063K4aoaM8qhekTODy2h dtCc+2gJQzLC3SJwjoBnMdc2TzUwDUzO8BViZJnCTN/IL31YLOXOPHaoHalIlVwc6/i8 aLMEeL5TuvUVb8laiuK3YOiRlmRLQPAj7aIPjq5yPcmMllvgIKL5lR86DnYQqUQ3nsID arhw==
X-Gm-Message-State: ACgBeo3sTwwOPQtgx1QjJbdZcHKUn0g4ALgHIWFmn6kna7uaXyHZ4EKo JdDXnMFKlVJgpyVtYIsX7VbVkms9FTfpLl03a4UZEnn49OdPlNY5
X-Google-Smtp-Source: AA6agR7TWay/XpKzhxamDt6/7GeI5yYLMxwJXhwZB4hN0Toe7pzx6G+8+vXsXmMUXAmoAqbKR4jUQPWQcy9e4xT1IIU=
X-Received: by 2002:a17:907:2c4a:b0:730:87fe:2a88 with SMTP id hf10-20020a1709072c4a00b0073087fe2a88mr3467231ejc.313.1659665243115; Thu, 04 Aug 2022 19:07:23 -0700 (PDT)
MIME-Version: 1.0
From: Me
Date: Fri, 5 Aug 2022 10:07:11 +0800
Message-ID:
Subject: Test 2 Title
To: test@inbound.my.domain
Content-Type: multipart/mixed; boundary="0000000000004342d505e574ed3e"

--xYzZY
Content-Disposition: form-data; name="attachment2"; filename="Test document 2.pdf"
Content-Type: application/pdf

%PDF-1.3
%�����������
3 0 obj
<< /Filter /FlateDecode /Length 173 >>
stream
x}�1�0����S�&�i���dU\܄�Y���С���iJ$C.��_�0�:�����őVT��I�B�
��B t=N7/ċ������/�G�L0�'���Vb)co
�JQ���$�m�BZ�P+�����ӳ�F)�_q������/�s^mc&x|���ǯ�����:�
endstream
endobj
1 0 obj
<< /Type /Page /Parent 2 0 R /Resources 4 0 R /Contents 3 0 R /MediaBox [0 0 595.2756 841.8898]
>>
endobj
4 0 obj
<< /ProcSet [ /PDF /Text ] /ColorSpace << /Cs1 5 0 R >> /Font << /TT2 7 0 R
>> >>
endobj
8 0 obj
<< /N 3 /Alternate /DeviceRGB /Length 2612 /Filter /FlateDecode >>
stream
x��wTS��Ͻ7��" %�z �;HQ�I�P��&vDF)VdT�G�"cE��b� �P��QDE�݌k ��5�ޚ��Y������g�}׺P���tX�4�X���\���X��ffG�D���=���HƳ��.�d��,�P&s���"7C$
E�6<~&��S��2����)2�12� ��"�įl���+�ɘ�&��Y��4���Pޚ%ᣌ�\�%�g�|e�TI���(����L0�_��&�l�2E�����9�r��9h�x�g���Ib�טi���f���S�b1+��M��xL����0��o�E%Ym�h�����Y��h����~S�=�z�U�&�ϞA��Y�l��/��$Z����U�m@���O� ��ޜ��l^���'���ls�k.+�7���oʿ�9�����V;�?�#I3eE妧�KD����d�����9i���,������UQ�� ��h��<�X�.d
���6'~�khu_}�9P�I�o=C#$n?z}�[1
Ⱦ�h���s�2z���\�n�LA"S���dr%�,�߄l��t�
4�.0,`
�3p� ��H�.Hi@�A>�
A1�v�jpԁz�N�6p\W�
p�G@
��K0ށi���A����B�ZyCAP8�C���@��&amp;�*���CP=�#t�]���� 4�}���a
���ٰ;G���Dx����J�>����,�_“@��FX�DB�X$!k�"��E�����H�q���a����Y��bVa�bJ0՘c�VL�6f3����bձ�X'�?v 6��-�V`�`[����a�;���p~�\2n5��׌����
�&�x�*����s�b|!�
ߏƿ'� Zk�!� $l$T����4Q��Ot"�y�\b)���A�I&N�I�$R$)���TIj"]&=&�!��:dGrY@^O�$� _%�?P�(&OJEB�N9J�@y@yC�R
�n�X����ZO�D}J}/G�3����ɭ���k���{%O�חw�_.�'_!J����Q�@�S���V�F���=�IE���b�b�b�b��5�Q%�����O�@���%�!BӥyҸ�M�:�e�0G7��ӓ������ e%e[�(�����R�0`�3R��������4������6�i^��)��*n*|�"�f����LUo�՝�m�O�0j&jaj�j��.��ϧ�w�ϝ_4����갺�z��j���=����U�4�5�n�ɚ���4ǴhZ�Z�Z��^0����Tf%��9�����-�>�ݫ=�c��Xg�N��]�.[7A�\�SwBOK/X/_�Q��>Q�����G�[��� �`�A�������a�a��c#����*�Z�;�8c�q��>�[&���I�I��MS���T`�ϴ�k�h&4�5�Ǣ��YY�F֠9�<�|�y��+=�X���_,�,S-�,Y)YXm������Ěk]c}džj�c�Φ�浭�-�v��};�]���N����"�&�1=�x����tv(��}���������'{'��I�ߝY�)�
Σ��-r�q��r�.d.�_xp��Uە�Z���M׍�v�m���=����+K�G�ǔ����^���W�W����b�j��>:>�>�>�v��}/�a��v���������O8� �
�FV>2 u�����/�_$\�B�Cv�< 5]�s.,4�&�y�Ux~xw-bEDCĻH����G��KwF�G�E�GME{E�EK�X,Y��F�Z� �={$vr����K����
��.3\����r����Ϯ�_�Yq*���©�L��_�w�ד������+���]�e�������D��]�cI�II�OA��u�_��䩔���)3�ѩ�i�����B%a��+]3='�/�4�0C��i��U�@ёL(sYf����L�H�$�%�Y�j��gGe��Q������n�����~5f5wug�v����5�k��֮\۹Nw]�������m mH���Fˍe�n���Q�Q��`h����B�BQ��-�[l�ll��f��jۗ"^��b����O%ܒ��Y}W�����������w�vw�����X�bY^�Ю�]��������W��Va[q`i�d��2���J�jGէ���������{������׿�m���>���Pk�Am�a�������꺿g_D�H���G�G��u�;��7�7�6�Ʊ�q�o���C{��P3���8!9������<�y�}��'�����Z�Z���։��6i{L{���ӝ�-?��|�������gKϑ���9�w~�Bƅ����:Wt>���ҝ����ˁ��^��r�۽��U��g�9];}�}���������_�~i���m��p���㭎�}��]�/���}�������.�{�^�=�}����^?�z8�h�c���'
O*��?�����f������`ϳ�g���C/����O�ϩ�+F�F�G�Gό���z����ˌ��ㅿ)����ѫ�~w��gb���k���?Jި�9���m�d���wi獵�ޫ�?�����c�Ǒ��O�O���?w| ��x&mf������
endstream
endobj
5 0 obj
[ /ICCBased 8 0 R ]
endobj
2 0 obj
<< /Type /Pages /MediaBox [0 0 595.2756 841.8898] /Count 1 /Kids [ 1 0 R ]
>>
endobj
9 0 obj
<< /Type /Catalog /Pages 2 0 R >>
endobj
7 0 obj
<< /Type /Font /Subtype /TrueType /BaseFont /AAAAAC+Calibri /FontDescriptor
10 0 R /ToUnicode 11 0 R /FirstChar 33 /LastChar 43 /Widths [ 487 498 391
335 226 525 527 423 525 799 525 ] >>
endobj
11 0 obj
<< /Length 283 /Filter /FlateDecode >>
stream
x]��j�0��z�=��`ʼn����|�u����Z�|��w��)�0�owg��S�\[({��j8Po��<��WL_����Q�F���։�f���G*KA�}�2���I�?�ڛ�썽���ԤJ3;���@RTi����u����%���蛰�����\���FR��ɵ�}k/,J)��|�[��u���6�o�2J�bW�2ρ���"���x�F,������BN�������{BX�6��.uu���(F����B���
���@���������C�~���a
endstream
endobj
10 0 obj
<< /Type /FontDescriptor /FontName /AAAAAC+Calibri /Flags 4 /FontBBox [-503 -313 1240 1026]
/ItalicAngle 0 /Ascent 952 /Descent -269 /CapHeight 632 /StemV 0 /XHeight
464 /AvgWidth 521 /MaxWidth 1328 /FontFile2 12 0 R >>
endobj
12 0 obj
<< /Length1 18708 /Length 9244 /Filter /FlateDecode >>
stream
x�{yxTE�~��kzIw'�l��;4I�����!YXHC'�N�!!�K��2"�+:n3��4 ��uw�q�qF�eFE!�[�t!8�|�����u����SU�V��[u���zZ���2
ټ����������ի~�(�`Z�m6�4gU�;��[�H3���b�'X1��v:�}ew"��<�E�#��
π�M��B\(D�[��,�&!6
�A��B�b�k�X-D����b��B�b�˄�b�K�X,D���h�U�!��h�Q�!
@�z!�1O�:!j�
1W�9B��b�����J��B�b�ӄ��B�r!ʄ�*D�%BQ$�!&��P�IB\ D��� D�yB�"W�qB�b���%�H!r��"K�L!|B�b�Ä�"]�4!�
�b��Bx�p�"D�IB��H"A�x!℈�)D��BD ��.�M�H!�BX�0a"B�!�B���
�BB���4(�!N���qJ����V� ��_����B|)�B|.�gB��S!>���c!>�oB�U�����!��OB�'ĻB�#��B�%����o
������
��/��/
q\��x^�����
��O��O
qL�� ���qT�#B<&ģB<"��B��B�!!�_�}B���B�A!�~!�b���7B�+�=B�-�]B�)į��C�ۅ�#�mB�*�-B�,�MB�(�n!n�z!v q�;��V�_ q�Wq�W
�C�+��\�>!.�R!�q�q�ۄ�*ąB�
�E��Blb��X/�:!�
�F��B��J�n!��X)D�+�X.�2!:�X*�!�.�"!ڄh�E�f!��h�A��B,�^��B��N�Z!�B�b�!j��-�,!���)�!� Q)D��B� 1U�R!J�(�hZ�/
�Lr��9��m%��P�X�dm!�J������D���%OF����"���D=T���n�.r�%OA�N�D˩�2������\B����hQ[(�UZ�j!j&j"j$j ZH���Փ5�hQQ-Q�h.��Q
�l�YD�DUD3�fM'�FTITr�c�De!W��D�!W%���k����h
�M�v~�Bj7����9�h5�'�#O�K4���%CQF�"I�r���]Q&��h�p�aD:�(�b%�
�ЩDj�&J!J&J"r%�g Y D��ę���b��$�!g4Q����D6rFY�,Tf&2EP���@�%T���PB5HK�!�L�D�T��ΨU��d�@�=�)*���o��E�
�ס����U(~6��d���K�/��s�>#:I�)�}Bt��'���#��Q����!Y!��D�Oe"z����C�6�[T��d����P�\��P���D���U�W�^&z���Ht��/=O�{���ʳDϐ�i����$:F�;��Y�%:Be�=J�G�&:Lt�h�j$�!�D����b1�P(v��H!z������#�K��P,v}�7�^�{��n����$�5�D��!����JQn!���n"��h7�
��z�v]G��ʮ�(�"��ʮ&���J�DWP����#���R��D������!g�"�m!g��D��X�!'iKș�L���o�v�և�-�����%ZC����hQ7����+�:C�fDYA��S�eDDK��-�v�D��gmԼ���j6555-$Z@�����'�G���еt� �\���P����&�ET��c`U��֙�~���lM�d��Q�J��P$�r�ʈ���4�e%�����P�PQ(�4%U
�L�'*$���s�tY!G-��DB~���Sa�9��ܐ�4���� 92�M5G�|`#C�!�eS�,�B&���� N��e���mkq��=p
��o���
�5������/a||���S�����w�c�#�o����lw��3�|���������[��?X��ߴ�r�~���~͚�~x�e����"p�/���u�����A?��u��i�b�S�v���E�ch�;�{x����1�Q�J�#�.�Ön�a�*�!`8�C���G�>�B@?��׹0�w�o���ϼɽ׼��[�7���=���]�,���_w����=���۠o����&ĺ�v#�
�]��v��B�k�j��U���+M��;Lw��0���X���H���&幷z��
l l
l޻)`�$�7�6Unڰi醴7��������
{�����]8,_�������{{ڞ��U=��z��=Rq�4�G�Y���ӣ��
t��vXWUWo�ҥ��t��%�.�40xt_�+����e����t�]X޶,�\��(оwQ�-�%к�%М�h�k,̫,�[��W���.P��E�9y5��ޚ�������Ձ�y33���W���2P�W(�[��W(��Y�=ɓ����HBO�K�2��w���¥e.�uԥ��%�����hf��"aK�U [����?~xf�-�Ÿ?�}����
�.e��XO����;���m_la1��q�Xݱ��R�S�9�N��s�t �HIb��1��~��.�<
�,c�t5��U٬J�X5O�.U�f�wu���Ta��y�~I���_��j����:�/ޱ�%O�T�gC�={���V*�\���䚡J�oAwO�/迀9�w|��8��_��6�d�
�d�
��E�#e�6��G�_j���2�jb�Vxx*3,U5�6��,
�3Ͳ�\XT�7g�,��q����+�V-��A�?j�n���v���@�/��UC���x�a(��7�?P"���/����Hp��|���l.z�-�f`����k�5�j�Xt+�N`�XtK�%�b�X��@�4�@�X���y@P��� ���Y@5P�fӁi@%P�e�T�(��"`
0���$���L��<`<���c���(`$�dY@&�FÁa@��C/0H<�H��$�$ @&lt;�N ��`l@$`,�0�0z@h'�]Ȁ0�"�'�N?�����o��__��| |||�>>N>>�����g��}�O�{���;���[��?oo����///ǁ�������OOOǀ�O�G�#�c���#���a�0��}@��A��~�&gt;`/�[�7���=���]�����;�ہ=�m���-���M���n��z`p���p
p5pp%����..����ɽ�EPۀ���@/��l6���:`-�X
���n�X t+���2�X
,��"�
hZ�f� h��������Z ����
�����`P T�@0(J�b����·�_z�j������Dz�f������2v������-aݬ?���Zv��͚�6��l����)�q�,{��V��ƙu�e̢9��,���S�'��
�"��\+Z���3h��'���\;h?3��b&��U~��)�<�#WϬ��ܖ�C��+}i��̃g�9oU�۳:6��g���5b�-��-Ff����-W��([�k!ja{Q���V�N��u�U����O'tw��e+U�����Z���g�F�)��F�lD�zջ%���̅l���g��]�Y��.e�a�~޺�l�>v9��|%�����q^���jv
���Nv��n����������Fv+�
k�����T��]�aO��� {H�e3rKyiS3݉lĘ���c�暳�ڌl�q��ǽ��zN���<��mCM����<�(�����12�?��爏����)Z�o^>b����/���]���o�sk��w�[pގw�U���&u�����z������Nv��ƕ`��
�=�^�ۿe{�}��Q����v�:s
�g!����L>����������6�±Bg�b���X!����i����<
ߑ���Z��'���1�/}k�i�Pϱ߳�ً�IX���g`��^a��7%+����x?�^�}�"�d���0f�f�?�_�D�d{�\3�����I5x�����]�O&��xi��L�?����|���o����1���Wuw��\�|Y��%�����4-\P?^]m0P3{Vu��ӧUV��M--).�2�_8邂������������6�;���۬fS�Ѡ�i5x>�,��6x��E��-+�⶷��s
�����(ޮE����f�Oj����lM��)`Y���Gy����ꪃ�;���太��Z��V��h�)�o/�(R��D)]��W�P��)��MEޢVSV&�7�!�P�0og�4l��
yXɄ~�����&���E����RSkU+Rc)�"Š��,V�gv��?�h�v��೴x[�M#�iJ���+�2�[�_�a<تdz�K���u���K�{=}_3t�{�S��OcأO��x!��4)R��}C1��Tޗ��� ��[$�Ú\!����*r/9*J�^�+J�6o�"�%ޒ�����x��ɓ���U�m�=�&�����sck��#D.YMP�C���,�����
�b��ꠒ��Tb�S(�p HZ���A� yK��"�54�[)9%h�%R��'�w���V�1��������acY-��[�II/���)�W�g�'�JU��H_�7�Z�g�kW������ T[al?�-*c؊!�� �.M-�-8<�x�N)@�]ѓ�gtJ�'(������kpu^���24�iQ�+�[}��.�h��b<�'-:���Ot������)i->�����v0�?�S��']0��,�c�ʔ�=(6*2Ʃ��,�{V� z[��^�!U�Oϵ:������Uu�ë��<����La��5Aa�O��R�:�|ZU{�j�5�~R\.��ﰪ���~�I�K��/�BWty�2�W�U�|�T�Ϭ�~#���4��-���-m�z��ҾƁ�ަ�~������}��>oyK�wv���n�\�y_�X�TY3�d6��+]Z���.�]�Z�?]���w�y@K%~A��|�T{X��%v^r�� ���3���@�I�7�#��*#�|JB�F����HV�Տ���J�?��:�F"�a�5�����dƫ����@����,��wԘ�_�B�۱�pДxZ���X���P�w���_I����"{'��z�b��NQ��)�_�����s��;E�b%L�6ݾ/6b�SA|�Q��o緷��� ���:Y��{~>PT"|8�ti�7����Jos#�`/�[Oys-nvUʕD�G@�R�
��Шk
Rm�C��Uj}���żG�]ae� �>�b����rj���������)m;������É�Gd����^57x�u��ٸ���0�uO+�|mz�
�+\���4if�I��F@�rm�F@�j�>x����k�3z�~N*�
�����w;:ϫ>��T�Y޵��y��KP�X��q�Q{3<�<���i��c#���܂�cK�ǻ�oq╕���_�u7*����C����4��kU�}}F�n@�2Z�2���4�c
����<%���V��3P,��W�š&�q�AG��'��R�k��U�^���Jq�?���}�����[(W-��S�o��5KQ\����l@�M���}�K���D�Z�ψ��c�N��7U��h�<��-�����M��� 6a�#=�
}�}������_IY�;/$� �!³��Vyj=
x4�����.܍`O[���6���
��o�$Pc_��u)Lm���T8�ժyU�W�ۆ����}����2§��+���N����?B�z��V�m)��f���U�Ž܊���c\��_���5�y����L8���<�}؂�qzhӛ�4���'�G��F,䵜[�D#�xE�xo����
i?z�����Qe�=�T�D#�~��V�9.���"��Ά��}
�ӥ�#�~,=o�Qd�4=j�r�[M5�G=D�[��8m�94߅����i#���L�7f�4�:�X֠����[�n���<V�Ie��,�Nܸ���`>'��S�-e|;�L(�2#��e���vD#�'��L�N՞�]��4Ȇ�P��'lݚW�i����t6�]�\�>��h�e�����,�cR.��g�F|
]��ie����B��q�G�����аߢ�~�������9)����{ؿ<�����k�·�1�փh:�{�c�F��C�(����~ٰ�A�}��}�s|�}�9�Vr�:T�D�C��;$[���;f��I�����!����;~�f��Y����$s[Ҽ�C�f�i���[8g�.%�c��������4��yi���A��
��OR�Q2�-�#��e4F%�:���o�"O�C�}���������C57���V�H�O11�|�-ڮ5G��FC��2�x��K�I<F��I�NO�\�Oi�D���^����~�4=����PL?0��>�4��>[�Q�<�p�x�|Xv0���(s���a���-VXxr����R��I������y��j���B�h�^��T�H�#��w,��3��6�j<����?$�+�Q�Û�"�5B�=��0~��b������H����b�u�'5ͳl{���?�����>>Rd?�2�#�#�G��Q|�7���~kN�����o����H���
�'�x�"�e�2$}�t,��|'�7)��5��>��E�;��
�#숮����9��D�(����D3�
�J���%�s4:E����-9�G�
*�9��Z�M^���W]<.>B/GYm� k�������,�As�#�aMHK��o��s�����C�#���2ܩ�R>0w[�7��5F'�fl@Vo�g���s�y��'JfW� �7!k�v�8ߎ�����?�/0ˡ���S
VS�2�~���M~Stj�9?å�1 �B�c$�����i|q����/�r(����5���7���������H�v�ژ/�BoM��u������9(��S����"��57I1����{^�s��n�f��m~C�;>�qwѦ������9�S/��f$`ej�X�k�ϙ���i��M-)��+_�V����s�6����^5�h�[����<�|�� 5�#rrsW�j�=�o�Y��Nʹ#e�<��<��v�]��5�݁bߝ>ه�@M�Xmx�����h�x?o���NM�|�W{�V>��^�JZmR�;��'";#�ȈI�r����ϩ_م
V���w}���n��0D��t�j5Fz�;���':X����L�8сX|M�s9>�n�Xǩ��`���\vf��sa���H8J)������Xf�F�̹sV�W��5�`���%�5dݭY������Ȳ��Z�vN�3�i�L��F�,����I�֯:taIq�M���;�����'���S����*)Eͽ+ʎ\E�<���iZF<��%�F�7C�����{��|��[F����?%%���2����2jR�̈́y;X�wHӫ&a�Q��sv5,l�3}��D�/F3;v��
l!z�urŤҬ���i �����0*?��-�N�ͧ�E>~Ϩ��꯴#���ʊ�j�Ȏ���Ρx��s���l�DzÏ[��;hSr:ss�yGǤS��1ʃ�&��Y���]b���ǥFb3���W�4!�m�G%��&�
Ӯ*ϫ-iϪ��:t��rw��l�j�&{�
N_�����&�l\���3yب���]6�f]��>�
��n�Y�S_8V�fV��թ�Wfڕb滟�O��o�f>�f>�f�������d�MY#������dI9bj촭�g�՟�61w�ӆ� �o�q~���=��(c|v��I�=��O��0-���ڦ�$��%Il`ع�i���2سj�
�Kâ��)�*�[�t��n�Fh�Ე>����G2Xݧ�r$-�oO)9&���������0&
���y�9�?�a�G���NLg€$�l^���:l\�P^��(��/W��7��a���F����&V}@%X�uyG��Pм7����w-��ᆵ&lt;�פ%3���
��,[R������%�S6��W�7�om��p�?�cl�;O��I�8�W.���Yr*+gVn�|�R7��C�N����}�*�{��GB&H���CGmq�u��K�ŗ���iϡ�0��I��`0�~�������E�d�;��������th�;�;bޞ��
���������#??'��~Ҏ�[���7l�p��S!m|���'�awx�H�8���5�.�c�u���a� Ag��@�U�1�䝭�x��n�(�i����,�:c�ܒ��&��l0�
���(���W���gm�5�l�p�A��L��!��9#�Ý�����RdIGE�-.!f�;:�npy\Q�ܴ����C|���k,ϴD9�[�ݑ`7�&�F{G&e��2����f����2��l���������
�t�1+`u6��Ӷʘ�,~`X��Y'�e�֓qe����o����"�PfG�pL}�D���珳���+3���Pq���Eh��8�C��܍u:��̟%���X�)/3�=ó�J[�ɛmQ��{�{4u�-�(�G���
M�1�"t�y�C������r�ght������Gb�P�S��S�.29�ɟ#5���u��k�|�f���aD.2��1����1~H2w�~��>�p��a�+�䐾�GDg�g�u �8�t?>L�CR��g0=LF�D��>B�6瞂� �죣C}��ցgǨdg\�C?}���b<�8ތq9e#'m(�3$N����������E�5�CĹu����҂�Gx�P��Ģ���[6���|E������0n�
endstream
endobj
13 0 obj
<< /Title (Microsoft Word - Document1) /Producer (macOS Version 12.4 \(Build 21F79\) Quartz PDFContext)
/Creator (Word) /CreationDate (D:20220719012947Z00'00') /ModDate (D:20220719012947Z00'00')
>>
endobj
xref
0 14
0000000000 65535 f
0000000267 00000 n
0000003225 00000 n
0000000022 00000 n
0000000381 00000 n
0000003190 00000 n
0000000000 00000 n
0000003367 00000 n
0000000478 00000 n
0000003318 00000 n
0000003925 00000 n
0000003569 00000 n
0000004161 00000 n
0000013494 00000 n
trailer
<< /Size 14 /Root 9 0 R /Info 13 0 R /ID [ <9389f7729712b6bb8ccc882a7b8468cd>
<9389f7729712b6bb8ccc882a7b8468cd> ] >>
startxref
13708
%%EOF

--xYzZY
Content-Disposition: form-data; name="dkim"

@{@my.domain : pass}
--xYzZY
Content-Disposition: form-data; name="content-ids"

{"f_l6fttqm81":"attachment2","f_l6fttqlx0":"attachment1"}
--xYzZY
Content-Disposition: form-data; name="to"

test@inbound.my.domain
--xYzZY
Content-Disposition: form-data; name="html"

Test 2 Body


--xYzZY
Content-Disposition: form-data; name="from"

Me
--xYzZY
Content-Disposition: form-data; name="text"

Test 2 Body

--xYzZY
Content-Disposition: form-data; name="sender_ip"

209.85.218.45
--xYzZY
Content-Disposition: form-data; name="attachment1"; filename="Test document.pdf"
Content-Type: application/pdf

%PDF-1.3
%�����������
3 0 obj
<< /Filter /FlateDecode /Length 173 >>
stream
x}�1�0����S�&�i���dU\܄�Y���С���iJ$C.��_�0�:�����őVT��I�B�
��B t=N7/ċ������/�G�L0�'���Vb)co
�JQ���$�m�BZ�P+�����ӳ�F)�_q������/�s^mc&x|���ǯ�����:�
endstream
endobj
1 0 obj
<< /Type /Page /Parent 2 0 R /Resources 4 0 R /Contents 3 0 R /MediaBox [0 0 595.2756 841.8898]
>>
endobj
4 0 obj
<< /ProcSet [ /PDF /Text ] /ColorSpace << /Cs1 5 0 R >> /Font << /TT2 7 0 R
>> >>
endobj
8 0 obj
<< /N 3 /Alternate /DeviceRGB /Length 2612 /Filter /FlateDecode >>
stream
x��wTS��Ͻ7��" %�z �;HQ�I�P��&vDF)VdT�G�"cE��b� �P��QDE�݌k ��5�ޚ��Y������g�}׺P���tX�4�X���\���X��ffG�D���=���HƳ��.�d��,�P&s���"7C$
E�6<~&��S��2����)2�12� ��"�įl���+�ɘ�&��Y��4���Pޚ%ᣌ�\�%�g�|e�TI���(����L0�_��&�l�2E�����9�r��9h�x�g���Ib�טi���f���S�b1+��M��xL����0��o�E%Ym�h�����Y��h����~S�=�z�U�&�ϞA��Y�l��/��$Z����U�m@���O� ��ޜ��l^���'���ls�k.+�7���oʿ�9�����V;�?�#I3eE妧�KD����d�����9i���,������UQ�� ��h��<�X�.d
���6'~�khu_}�9P�I�o=C#$n?z}�[1
Ⱦ�h���s�2z���\�n�LA"S���dr%�,�߄l��t�
4�.0,`
�3p� ��H�.Hi@�A>�
A1�v�jpԁz�N�6p\W�
p�G@
��K0ށi���A����B�ZyCAP8�C���@��&amp;�*���CP=�#t�]���� 4�}���a
���ٰ;G���Dx����J�>����,�_“@��FX�DB�X$!k�"��E�����H�q���a����Y��bVa�bJ0՘c�VL�6f3����bձ�X'�?v 6��-�V`�`[����a�;���p~�\2n5��׌����
�&�x�*����s�b|!�
ߏƿ'� Zk�!� $l$T����4Q��Ot"�y�\b)���A�I&N�I�$R$)���TIj"]&=&�!��:dGrY@^O�$� _%�?P�(&OJEB�N9J�@y@yC�R
�n�X����ZO�D}J}/G�3����ɭ���k���{%O�חw�_.�'_!J����Q�@�S���V�F���=�IE���b�b�b�b��5�Q%�����O�@���%�!BӥyҸ�M�:�e�0G7��ӓ������ e%e[�(�����R�0`�3R��������4������6�i^��)��*n*|�"�f����LUo�՝�m�O�0j&jaj�j��.��ϧ�w�ϝ_4����갺�z��j���=����U�4�5�n�ɚ���4ǴhZ�Z�Z��^0����Tf%��9�����-�>�ݫ=�c��Xg�N��]�.[7A�\�SwBOK/X/_�Q��>Q�����G�[��� �`�A�������a�a��c#����*�Z�;�8c�q��>�[&���I�I��MS���T`�ϴ�k�h&4�5�Ǣ��YY�F֠9�<�|�y��+=�X���_,�,S-�,Y)YXm������Ěk]c}džj�c�Φ�浭�-�v��};�]���N����"�&�1=�x����tv(��}���������'{'��I�ߝY�)�
Σ��-r�q��r�.d.�_xp��Uە�Z���M׍�v�m���=����+K�G�ǔ����^���W�W����b�j��>:>�>�>�v��}/�a��v���������O8� �
�FV>2 u�����/�_$\�B�Cv�< 5]�s.,4�&�y�Ux~xw-bEDCĻH����G��KwF�G�E�GME{E�EK�X,Y��F�Z� �={$vr����K����
��.3\����r����Ϯ�_�Yq*���©�L��_�w�ד������+���]�e�������D��]�cI�II�OA��u�_��䩔���)3�ѩ�i�����B%a��+]3='�/�4�0C��i��U�@ёL(sYf����L�H�$�%�Y�j��gGe��Q������n�����~5f5wug�v����5�k��֮\۹Nw]�������m mH���Fˍe�n���Q�Q��`h����B�BQ��-�[l�ll��f��jۗ"^��b����O%ܒ��Y}W�����������w�vw�����X�bY^�Ю�]��������W��Va[q`i�d��2���J�jGէ���������{������׿�m���>���Pk�Am�a�������꺿g_D�H���G�G��u�;��7�7�6�Ʊ�q�o���C{��P3���8!9������<�y�}��'�����Z�Z���։��6i{L{���ӝ�-?��|�������gKϑ���9�w~�Bƅ����:Wt>���ҝ����ˁ��^��r�۽��U��g�9];}�}���������_�~i���m��p���㭎�}��]�/���}�������.�{�^�=�}����^?�z8�h�c���'
O*��?�����f������`ϳ�g���C/����O�ϩ�+F�F�G�Gό���z����ˌ��ㅿ)����ѫ�~w��gb���k���?Jި�9���m�d���wi獵�ޫ�?�����c�Ǒ��O�O���?w| ��x&mf������
endstream
endobj
5 0 obj
[ /ICCBased 8 0 R ]
endobj
2 0 obj
<< /Type /Pages /MediaBox [0 0 595.2756 841.8898] /Count 1 /Kids [ 1 0 R ]
>>
endobj
9 0 obj
<< /Type /Catalog /Pages 2 0 R >>
endobj
7 0 obj
<< /Type /Font /Subtype /TrueType /BaseFont /AAAAAC+Calibri /FontDescriptor
10 0 R /ToUnicode 11 0 R /FirstChar 33 /LastChar 43 /Widths [ 487 498 391
335 226 525 527
«1

Comments

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    Xano lambdas support the nodemailer library which has a mailparser to help with this job.

  • thanks for the pointer! I just did a quick run but getting a ‘MailParser is not defined’ error. Seems like We won’t be able to use it because it requires an additional npm installation of the Mailparser package on top of Nodemailer and I don’t think that is included in Xano’s supported library yet.
  • Future
    Future Member
    Options
    Following... Having the exact same problem. Currently using another service to parse my emails and give me s3 links to download attachments but a one stop solution would be amazing.
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
     doh! I ran it up the Xano team flagpole - will let you know what I hear back! 

  • thanks so much Ray. Appreciate it!

  • looks like it’s not something we can handle in Xano immediately. May I know what service are you using to parse your emails at the moment? I’m interested to find out too. Three solutions I’ve found so far are Mailgun and Sendinblue which are able to parse the inbound mail into JSON.
  • Future
    Future Member
    Options
     I'm using Pipedream to parse emails... They're a quite impressive automation service on steroids with js/python capabilities. But the most amazing function is the ability to just setup a random email address that parses everything it receives...

    Steps i've done (on Bubble) :
     
    1. Setup your pipedream account
    2. Add a Trigger : Incoming email (it’ll give you an email address to send all your emails)
    3. (Optional) : Setup a forwarder to that email address.
    – Example : We are using Google Workspace (sometimes Office 365). I registered a subdomain to receive emails… Ex. our domain is domain.com, i added MX settings for example : bubble.domain.com
    – Any email sent to any address @bubble.domain.com will go to pipedream.
    4. Back to pipedream : Setup a webhook action to your backend workflow initialize address
    5. Once the init is done, remove /initialize from the URL

     [Image] 
     

  • Wow that’s a neat solution! Just one question - in step 3, what is the value of the MX record that you use to direct all the emails sent to @bubble.domain.com to pipedream? Like for SendGrid it’s mx.sendgrid.net but I can’t seem to find the equivalent for pipedream from the docs.
  • Future
    Future Member
    Options
     I added my a subdomain specificaly to be a catch all address with Google Workspace... If domain was abc.com i created an mx record for app.abc.com so my users can send email to any address @app.abc.com... and the main setting is in Google to set it up as a catch all -> forwarded to pipedream's address. (mx is something like "app 0 [google's mx settings]"

    So to make it short, (lol) in my case, it ain't pipedream that my inbound server.. it only provides an email address where i can send anything i want.

  • Ah gotcha. That’s a really creative setup! I’m gonna give it a go. Thanks so much man for the idea
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
     FYI New Xano update dropped with Mailparser support! 

  • woooooot!!! This is so great! Thanks so much Ray & Xano team for making this happen. You guys are amazing 🙏🏼🙏🏼🙏🏼
  • Sönke Manaré
    Options
      That sounds great. I am currently using MailJet to parse inbound mails and send the result as JSON to Xano. Can you explain briefly, how the new Mailparser in Xano can be used?
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
     Mailparser is a subsystem of Nodemailer that parses emails. Nodemailer is included in the Xano lambdas. Here's the relevant docs that give a flavor of what it does:

    https://nodemailer.com/extras/mailparser/
  • Sönke Manaré
    Options
     that’s great! Will have a look at it.
  • Future
    Future Member
    Options
     Stupid me here again haha, I was wondering if anyone made a snippet or how-to with this lambda? I'm not great with js and i'm starting to lose my (remaining) hair trying to get the email info (header, body, etc) as json and attachments with info ready to be used in my stack.
  • Future
    Future Member
    Options
     Just curious, did you end up using mailparser? Trying to figure it out but I'm bad at this hahaha
  • MichaelR
    MichaelR Member
    Options

    @Michael Udinski or @Future , is there any tutorial or video or instructions to run mailparser via Lambda on a variable that contains the email data we want to convert to something readable?

    I've called Gmail's API to get a message/email and that is working well but all the data needs to be converted. There aren't any instructions on how to apply Lambda/mailparser to an email body... Any help would be greatly appreciated. Thanks.

  • Future
    Future Member
    edited January 2023
    Options

    @MichaelR here you go. I made a snippet for everyone to parse a webhook or to download a raw email file and convert it to an object variable. Delete the group you won't use :)

    https://www.xano.com/snippet/UbdFLSlf/

    * Disclaimer : You need lambda (so, you need a paid account)

    EDIT : Published the snippet here : https://community.xano.com/discussion/4178796/mailparser-raw-email-to-object

  • MichaelR
    MichaelR Member
    Options

    Hey @Future , thanks for that, super appreciated.

    When I get an email from GMAIL, the response looks like the following, how would you incorporate that into your snippet?

    response: {headers: [HTTP/2 200,

    content-type: application/json; charset=UTF-8,

    vary: Origin,

    vary: X-Origin,

    vary: Referer,

    content-encoding: gzip,

    date: Fri, 30 Dec 2022 13:16:19 GMT,

    server: ESF,

    cache-control: private,

    content-length: 21261,

    ... +3 more

    ],

    result: {id: 184151ae8cbebbb5,

    threadId: 184151ae8cbebbb5,

    labelIds: [UNREAD,

    CATEGORY_UPDATES,

    INBOX

    ],

    snippet: Book a free 1:1 consultation with a Google Ads expert. Get started with a free 1:1 consultation - call 1 844 229 2211844 229 2211 † to speak with a Google Ads expert. Here&#39;s $500 to grow your,

    payload: {partId: ,

    mimeType: multipart/alternative,

    filename: ,

    headers: [{name: Delivered-To,

    value: michael@junglebee.io

    },

    {name: Received,

    value: by 2002:aa6:d9a1:0:b0:22a:b395:493e with SMTP id bt1csp488244lkb; Wed, 26 Oct 2022 09:23:16 -0700 (PDT)

    },

    {name: X-Received,

    value: by 2002:a9d:30d8:0:b0:66b:3596:9639 with SMTP id r24-20020a9d30d8000000b0066b35969639mr74654otg.363.1666801395996; Wed, 26 Oct 2022 09:23:15 -0700 (PDT)

    },

    {name: ARC-Seal,

    value: i=1; a=rsa-sha256; t=1666801395; cv=none; d=google.com; s=arc-20160816; b=zm/xjojLATowUPXM/gysNdG/vtcnMWOQ/6BgFcZf7+Z//lnUMOyzvLN6tFy6xFjupH

    },

    {name: ARC-Message-Signature,

    value: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:message-id:list-id:fe

    },

    {name: ARC-Authentication-Results,

    value: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=PO261VKX; spf=pass (google.com: domain of 3815zyxekbzgqilemjuwy-h

    },

    {name: Return-Path,

    value: <3815ZYxEKBzgqilemjUWY-hilYjfsaiiafY.WiggcWbUYfdohafYVYY.ci@scoutcamp.bounces.google.com>

    },

    {name: Received,

    value: from mail-sor-f69.google.com (mail-sor-f69.google.com. [209.85.220.69]) by mx.google.com with SMTPS id

    },

    {name: Received-SPF,

    value: pass (google.com: domain of 3815zyxekbzgqilemjuwy-hilyjfsaiiafy.wi

    },

    {name: Authentication-Results,

    value: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=PO261VKX; spf=pass (google.co

    },

    ... +20 more

    ],

    body: {size: 0

    },

    parts: [{partId: 0,

    mimeType: text/plain,

    filename: ,

    headers: [{name: Content-Type,

    value: text/plain; charset="UTF-8"; format=flowed; delsp=yes

    },

    {name: Content-Transfer-Encoding,

    value: base64

    }

    ],

    body: {size: 3895,

    data: R2V0IHN0YXJ0ZWQgd2l0aCBhIGZyZWUgMToxIGNvbnN1bHRhdGlvbiAtIGNhbGwgMSA4NDQgMjI5IDI

    }

    },

    {partId: 1,

    mimeType: text/html,

    filename: ,

    headers: [{name: Content-Type,

    value: text/html; charset="UTF-8"

    },

    {name: Content-Transfer-Encoding,

    value: quoted-printable

    }

    ],

    body: {size: 44979,

    data: PCFkb

  • MichaelR
    MichaelR Member
    Options

    When I do a call to gmail API to get a specific email, I do not get a response that includes a raw email URL. Can you please provide further details on how to use your snippet?

  • Future
    Future Member
    Options

    Can you send me a pm with a full copy of the JSON? (without the "... +20 more" stuff)

  • MichaelR
    MichaelR Member
    Options

    damn, I can't send a message in this forum to you privately... And I can't paste the full response either as it won't let me due to the character limit. Are you able to PM me?

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    Michael, you can use something like https://codeshare.io or https://pastebin.com/ to share extensive,technical text

  • MichaelR
    MichaelR Member
    Options

    Thanks @Ray Deck , great idea. Here is the response I get for calling gmail and return an email with the "raw" format. https://codeshare.io/Jb1eed

    Not sure how to take that response and apply it to your snippet @Future ?

    Thanks all for your help!

  • MichaelR
    MichaelR Member
    Options

    Just a little bumpity bump on getting some help if possible please?

  • MichaelR
    MichaelR Member
    Options

    @Ray Deck do you by any chance have any insight into this? How would you implement the response I shared with the Xano snippet?

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    At a gloss, I would look into using the simpleparser feature of nodemailer, which is a package available in the lambda feature of Xano. Seems like a job where a few lines of javascript code could substantially simplify the situation.

  • MichaelR
    MichaelR Member
    Options

    @Ray Deck I know, thanks. That is pretty much what we are already discussing above in the thread and what @Future 's snippet does... What I am asking is what does the input need to look like for that snippet that uses Mailparser to look like?

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    @MichaelR I'd recommend trying it out! use a run and debug to get the inputs in, or save as a text field in a table for easy retrieval and repeat testing. In these kinds of discovery situations you'll dial into the needed shape a lot faster by setting up a trial/error loop. I was just doing that the other day with Xano and an external API, and cut the development time into a matter of minutes where the person I was working with had previously spent days on it.


    It's an interesting problem! If you like, you can bring it to a State Change Pro office hours - this is the kind of hard question we work on literally every business day. If you're interested in trying out the experience, I'd be glad to have you join us with a complimentary ticket to a session this week.