Processing Email (EML) Files

Private AI supports scanning Email (EML) files for PII and creating de-identified or redacted copies. Private AI’s supported entity types function across each file type, with localized variants of different PII (Personally Identifiable Information) entities, PHI (Protected Health Information) entities, and PCI (Payment Card Industry) entities being detected. Our Supported Languages and Supported Entity Types page provides a more detailed look.

info

If you'd like to try it yourself, please visit our free interactive web demo. No code or account is necessary.

How EML files Are Processed

attention

Email support is a new feature and due to the complexity of the filetype we do not yet support all the elements of the filetype. Whilst we are working on expanding support, please consider rendering and processing as a PDF. This will ensure all content is processed and redacted.

Functionally, EML files are processed in the same way as XML files following the defined standard for .eml files. The EML file is traversed as a standard XML with node attributes and text elements processed by Private AI's text module. Please see the constraints section to see the limitations of processing .eml files natively.

Constraints

  • Private AI currently only supports de-identifying the e-mail body and headers.
  • You may sometimes notice spurious detections on email headers as these lack context when they are processed. To work around this, you can create an allow text filter to skip headers using the entity_types->filter parameter in the process/files endpoints, or consider creating your own handler to process the specific elements.
  • XML, JSON and other embedded data such as code snippets are not processed natively and may lead to inaccurate PII detection.
  • Remote elements such as images and links are not retrieved and processed, please process these separately.
  • Email attachments are not processed and passed through to the processed file as they are considered a remote element.

Support Matrix

CPU Container GPU Container Demo API Prod API PrivateGPT UI
Supported? Yes Yes No Yes No

Sample Request

info

Please sign up for a free API key to run this code.

Copy
Copied
import requests
import base64

file_url = "https://paidocumentation.blob.core.windows.net/$web/sample.eml"
file_content = requests.get(file_url).content
file_content_base64 = base64.b64encode(file_content).decode("ascii")

url = "https://api.private-ai.com/deid/v3/process/files/base64"

headers = {"Content-Type": "application/json", "x-api-key": "<INSERT API KEY>"}

payload = {
  "file":{
    "data": file_content_base64,
    "content_type": "message/rfc822",
  },
  "entity_detection": {
    "accuracy": "high",
    "return_entity": True
  }
}

response = requests.post(url, json=payload, headers=headers)

Sample Response

Copy
Copied
"processed_file": "Base64 Encoded File Content of the Redacted File",
"processed_text":"string",
"entities":"List[Entity]",
"entities_present":true,
"languages_detected":{"lang_1":0.67, "lang_2": 0.74}
© Copyright 2024 Private AI.