LanguageValues and typesStandard typesPeople and contact
EmailWithName
An email address with the name shown beside it: Mary Somerville <mary@example.com>.
On this page
An email address with the name shown beside it: Mary Somerville <mary@example.com>.
Use it for the sender or recipient of a message when the name should appear in the reader's mail app. When you only need the address, use Email.
Shape
| Field | Type | Required? |
|---|---|---|
name |
Text |
No |
address |
Email |
Yes |
Write every field when you build one, and give a field that isn't required as none.
Example
EmailWithName { name: "Mary Somerville" address: "mary@example.com" }text.parse(raw, as: EmailWithName) reads one from text that comes from outside. Text that isn't one at all fails malformed, such as Mary Somerville, <mary@example.com> or Mary Somerville <mary>.
Good to know
text.parsealso reads a baremary@example.com, and gives itname: none.==tells you whether two are the same.<andlist.sort_bydon't take it, so sort by one of its parts instead.- A field that holds one counts as personal data (
contact), so you don't mark it yourself.
In JSON
An object of its parts, in a request, a response or json.write:
{"name":"Mary Somerville","address":"mary@example.com"}{"name":"Somerville, Mary","address":"mary@example.com"}{"name":null,"address":"mary@example.com"}
When you read one, a field that isn't required may be left out, or sent as null.
Details
Text form, storage, how it is shown, and operations
EmailWithName is in the group People and contact, and has been in Jadpo since 0.1.0.
Text form
text.from writes one standard text form, the same form text.parse reads back: Mary Somerville <mary@example.com>, "Somerville, Mary" <mary@example.com> and mary@example.com.
How it is stored
It is stored in 2 columns, each named for the field, _ and its suffix. This is "Somerville, Mary" <mary@example.com>:
| Column | Type | Holds |
|---|---|---|
<field>_name |
text |
'Somerville, Mary' |
<field>_address |
text |
'mary@example.com' |
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
Mary Somerville <mary@example.com> |
Mary Somerville <mary@example.com> |
"Somerville, Mary" <mary@example.com> |
"Somerville, Mary" <mary@example.com> |
mary@example.com |
mary@example.com |
Operations
It also takes text.parse, text.from, text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-email-with-name.md.Built from Jadpo main at aee2e8f.