How to convert an EML Email File to HTML String in Python

pip install cloudmersive-convert-api-client
from __future__ import print_functionimport timeimport cloudmersive_convert_api_clientfrom import ApiExceptionfrom pprint import pprint# Configure API key authorization: Apikeyconfiguration = cloudmersive_convert_api_client.Configuration()configuration.api_key['Apikey'] = 'YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['Apikey'] = 'Bearer'# create an instance of the API classapi_instance = cloudmersive_convert_api_client.ConvertDocumentApi(cloudmersive_convert_api_client.ApiClient(configuration))input_file = '/path/to/file' # file | Input file to perform the operation on.body_only = true # bool | Optional; If true, the HTML string will only include the body of the email. Other information such as subject will still be given as properties in the response object. Default is false. (optional)include_attachments = true # bool | Optional; If false, the response object will not include any attachment files from the input file. Default is true. (optional)try:# Convert Email EML file to HTML stringapi_response = api_instance.convert_document_eml_to_html(input_file, body_only=body_only, include_attachments=include_attachments)pprint(api_response)except ApiException as e:print("Exception when calling ConvertDocumentApi->convert_document_eml_to_html: %s\n" % e)




There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Installing Hadoop from source: build, patch and run

Setting up The Moss Giants Attack in Unity

Master and Apprentice Alike

Docker Installation & Basic Commands

Publisher-Subscriber Pattern 101

Connecting to Aerospike from Node.js

Deployment Of PHP Website On the Top Of AWS EKS Along with Prometheus And Grafana

May the code be with you: Web dev jedi Deryk King

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

Top 10 Best Django Packages to use in your next project.


How to install mysqlclient on MacOS and How to fix the error (Django)

You need to use this VS Code extension!

Coding With Python in 2022