Home Explore Blog CI



nushell

commands/docs/from_eml.md
7a2cb7932a286c00e1826bfbccb1a8dbc39ba8309781e10d0000000300000d8e
---
title: from eml
categories: |
  formats
version: 0.104.0
formats: |
  Parse text as .eml and create record.
usage: |
  Parse text as .eml and create record.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `from eml` for [formats](/commands/categories/formats.md)

<div class='command-title'>Parse text as .eml and create record.</div>

::: warning This command requires a plugin
The `from eml` command resides in the `formats` plugin.
To use this command, you must install and register `nu_plugin_formats`.
See the [Plugins](/book/plugins.html) chapter in the book for more information.
:::


## Signature

```> from eml {flags} ```

## Flags

 -  `--preview-body, -b {int}`: How many bytes of the body to preview


## Input/output types:

| input  | output |
| ------ | ------ |
| string | record |
## Examples

Convert eml structured data into record
```nu
> 'From: test@email.com
Subject: Welcome
To: someone@somewhere.com

Test' | from eml
╭─────────┬─────────────────────────────────────╮
│ Subject │ Welcome                             │
│         │ ╭─────────┬────────────────╮        │
│ From    │ │ Name    │                │        │
│         │ │ Address │ test@email.com │        │
│         │ ╰─────────┴────────────────╯        │
│         │ ╭─────────┬───────────────────────╮ │
│ To      │ │ Name    │                       │ │
│         │ │ Address │ someone@somewhere.com │ │
│         │ ╰─────────┴───────────────────────╯ │
│ Body    │ Test                                │
╰─────────┴─────────────────────────────────────╯
```

Convert eml structured data into record
```nu
> 'From: test@email.com
Subject: Welcome
To: someone@somewhere.com

Test' | from eml -b 1
╭─────────┬─────────────────────────────────────╮
│ Subject │ Welcome                             │
│         │ ╭─────────┬────────────────╮        │
│ From    │ │ Name    │                │        │
│         │ │ Address │ test@email.com │        │
│         │ ╰─────────┴────────────────╯        │
│         │ ╭─────────┬───────────────────────╮ │
│ To      │ │ Name    │                       │ │
│         │ │ Address │ someone@somewhere.com │ │
│         │ ╰─────────┴───────────────────────╯ │
│ Body    │ T                                   │
╰─────────┴─────────────────────────────────────╯
```

Chunks
bc6f53a5 (1st chunk of `commands/docs/from_eml.md`)
Title: from eml: Parse EML Data into Records in Nushell
Summary
The `from eml` command in Nushell parses text as .eml files and converts them into structured records. It requires the `nu_plugin_formats` plugin. The command supports a flag `--preview-body` to specify how many bytes of the email body to preview. Examples are provided to demonstrate the conversion of EML data into records.