# Creating .eml from icon\_email.json

**URL:** <https://discuss.rapid7.com/t/creating-eml-from-icon-email-json/43751>\
**Category:** Plugins\
**Created:** [October 16, 2024, 2:33pm UTC](https://discuss.rapid7.com/t/creating-eml-from-icon-email-json/43751 "2024-10-16T14:33:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![2tSecurity](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/2tsecurity/32/2724_2.png) [@2tSecurity](https://discuss.rapid7.com/u/2tSecurity)\
**Post date:** [October 16, 2024, 2:33pm UTC](https://discuss.rapid7.com/t/creating-eml-from-icon-email-json/43751/1 "2024-10-16T14:33:15Z")

</div>

Has anyone found an effective way of creating a .eml from the 365 Email plugin or the icon\_email.json output in general? My only workaround so far has been creating a .html to analyze the email body in addition to extracting the URLs and attachments. Was looking for a clean .eml submission to provide our sandbox tool(s).

---

<div class="post-metadata">

**Author:** ![Darrick\_Hall](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/darrick_hall/32/2530_2.png) [@Darrick\_Hall](https://discuss.rapid7.com/u/Darrick_Hall)\
**Post date:** [October 8, 2025, 10:32pm UTC](https://discuss.rapid7.com/t/creating-eml-from-icon-email-json/43751/2 "2025-10-08T22:32:28Z")

</div>

Hey Eric!

I am sure you’ve already figured out a solution for this, so very sorry about not providing an answer when you asked. I just noticed your question and figured I would partner with AI and give it a go.

I was able to accomplish this using the Python Plugin.

Taking the Office 365 email plugin trigger output, I pass the icon\_email variable to the python step, and it provides a base64 encoded output. That along with the extension .eml will accomplish what you are looking for. You can see in my screenshot I am taking the trigger payload, passing to python, and the output of base64 is what I am seeking.

 ![Screenshot 2025-10-08 at 4.23.33 PM](https://forum-uploads-hub-prod-1-us-east-1-rapid7-com.s3.dualstack.us-east-1.amazonaws.com/original/2X/4/4c926f8efc6cacbe2497f003b0460e81f358f551.png)

If I take that download file into CyberChef we can see it decodes just fine.

 ![Screenshot 2025-10-08 at 4.25.39 PM](https://forum-uploads-hub-prod-1-us-east-1-rapid7-com.s3.dualstack.us-east-1.amazonaws.com/original/2X/1/1bb90a58dcd6a4c174a38025c303ba3f25495753.png)

I then took it into Outlook to attempt to view it by saving the decoded output with the .eml extension and we get the results from the screenshot below.

 ![Screenshot 2025-10-08 at 4.27.45 PM](https://forum-uploads-hub-prod-1-us-east-1-rapid7-com.s3.dualstack.us-east-1.amazonaws.com/original/2X/f/fc3838c4e461b7bc31f5cfac13fec6080e307167.png)

I’ve attached the workflow for you. It also has a loop in there to pull out attached CSV and convert to JSON. Not needed for your use case, but feel free to make it your own.

[Office 365 email received trigger.icon](https://discuss.rapid7.com/uploads/short-url/iP67fnOt1Yx2iY7Agn71LS6H7ap.icon) (43.4 KB)

---

<div class="post-metadata">

**Author:** ![2tSecurity](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/2tsecurity/32/2724_2.png) [@2tSecurity](https://discuss.rapid7.com/u/2tSecurity)\
**Post date:** [October 9, 2025, 4:41pm UTC](https://discuss.rapid7.com/t/creating-eml-from-icon-email-json/43751/3 "2025-10-09T16:41:23Z")

</div>

Thank you! I’ve essentially gone through with encoding the email body using the Base64 plugin and submitting that as an HTML file, which does serve part of the purpose but I think this Python would enable to me to actually convert it to an .eml and submit it to a sandbox using office, so I really appreciate this.

Luckily we’re moving to a new malware analysis platform that will just host a mailbox so I’m hoping not to require too much more maintenance on breaking down the email json object in the near future.
