← All procedures
mail.parse
Read the headers, the addresses and the text of a raw email message
CLI- Package
- @procedures/mail · README
- Path
["mail","parse"]- CLI
mark mail parse --raw <string>- As data
{"$proc":["mail","parse"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/mail/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["mail","parse"], { raw: "<raw>" });
console.log(JSON.stringify(result));From the command line
$ mark mail parse --raw <string>
As data, in a program
{ "$proc": ["mail", "parse"], "input": { "raw": "<raw>" } }Input
Output
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"raw": {
"type": "string",
"description": "The raw message (RFC 822): the headers, an empty line, the body"
}
},
"required": [
"raw"
]
},
"output": {
"type": "object",
"properties": {
"headers": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "string"
}
},
"subject": {
"type": "string"
},
"from": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"address": {
"type": "string"
}
},
"required": [
"address"
],
"additionalProperties": false
}
},
"to": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"address": {
"type": "string"
}
},
"required": [
"address"
],
"additionalProperties": false
}
},
"date": {
"type": "string"
},
"text": {
"type": "string"
}
},
"required": [
"headers",
"from",
"to",
"text"
],
"additionalProperties": false
}
}