Email address to string

Email inbox Pure
Email address to string
Address(Email address)
Text

Description

Pure function formatting an email address object as text: "Name <[email protected]>", or just the bare address when the address carries no display name. Returns an empty string for a null address, so it is safe on a message with no parseable sender.

When to use

Use this whenever you want to show an address rather than take it apart — logging who a message came from, building a summary line, putting the sender into a Slack message or a ticket description.

Every participant field on an email is an address object rather than a plain string, because the display name and the address are two different pieces of information and both matter. from is a single object; to, cc and replyTo are arrays of them. When you need just the address part, Break the object and use its address field; when you need something human-readable, use this node.

It never fails. A null address — which from can be on malformed mail — formats as an empty string rather than erroring, so you can put it straight into a log line without a null guard. If you would rather substitute something visible, run the result through Default if null’s string equivalent or check it with String is empty.

For a whole recipient list, loop the array through For each and this node, collect the results, and Join them with ", ".

Pins

Input pins

Pin Type Default Notes
Address Email address — An email address object — a message's `from` field, or an element of its `to`, `cc`, or `replyTo` arrays. A null address is allowed and yields an empty string.

Output pins

Pin Type Notes
Text string `Name <[email protected]>` when the address has a display name, the bare address when it does not, and an empty string when the address itself is null.

Example

Log who each incoming message is from. After Find emails and For each, Break the element and wire its From field into Email address to string, then Concatenate the result with the Subject field and pass it to Log message. A message whose From header could not be parsed logs an empty sender rather than failing the run.

See also