Convert MS Graph API response (JSON) to EML format

Good Day Experts,

Is there any way to convert Json response of MS graph API to EML format ?

Note : can't use any mail poller plugin due to infrastructure restrictions so i'm forced to use MS graph API to fetch the mail details which is in Json format. If i wanted to use AI (email classification) i need to convert the JSON to EML file format.

Thanks in advance.

Cheers,

Kalai.

  Discussion posts and replies are publicly visible

  • Yes, it is possible to convert a JSON response from the Microsoft Graph API to the EML (Email Message) format. The EML format is a standard file format for storing email messages.

    • To convert the JSON response to EML, you will need to extract the necessary information from the JSON and construct an EML file with the appropriate headers and content. Here are the general steps you can follow:
    • Retrieve the relevant information from the JSON response: The JSON response from the Microsoft Graph API will contain properties such as sender, recipients, subject, body, attachments, and other metadata. Extract these fields from the JSON object.
    • Create the EML file structure: EML files have a specific structure that includes headers and body content. You will need to create an EML file with the appropriate headers to represent the email message. The headers typically include fields like From, To, Subject, Date, and MIME-Version.
    • Populate the headers: Use the extracted information from the JSON response to fill in the corresponding fields in the EML headers. For example, set the sender's email address in the From field, the recipient's email address in the To field, and the subject in the Subject field.
    • Construct the email body: Depending on the structure of the JSON response, you may need to format the content of the email body accordingly. This could include plain text, HTML, or attachments.
    • Save the EML file: Once you have constructed the EML file with the appropriate headers and body content, save it using the .eml file extension.

    rainbow friends