FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
std
stdparse_email
Public
Like
parse_email
Home
Code
2
README.md
S
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Sign up now
Code
/
Code
/
Search
README.md

Parse email

A small wrapper around email-addresses, an RFC 5322 email address parser.

Usage

Create val
import { parseAddressList } from "https://esm.town/v/std/parse_email"; console.log(parseAddressList('Steve <steve@val.town>, tom@val.town'));

Should output:

[
  {
    parts: {
      name: {
        name: "display-name",
        tokens: "'Steve ",
        semantic: "'Steve",
        children: [ [Object] ]
      },
      address: {
        name: "addr-spec",
        tokens: "steve@val.town",
        semantic: "steve@val.town",
        children: [ [Object] ]
      },
      local: {
        name: "local-part",
        tokens: "steve",
        semantic: "steve",
        children: [ [Object] ]
      },
      domain: {
        name: "domain",
        tokens: "val.town",
        semantic: "val.town",
        children: [ [Object] ]
      },
      comments: [
        { name: "cfws", tokens: " ", semantic: " ", children: [Array] }
      ]
    },
    type: "mailbox",
    name: "'Steve",
    address: "steve@val.town",
    local: "steve",
    domain: "val.town",
    comments: "",
    groupName: null
  },
  {
    parts: {
      name: null,
      address: {
        name: "addr-spec",
        tokens: " tom@val.town'",
        semantic: "tom@val.town'",
        children: [ [Object] ]
      },
      local: {
        name: "local-part",
        tokens: " tom",
        semantic: "tom",
        children: [ [Object] ]
      },
      domain: {
        name: "domain",
        tokens: "val.town'",
        semantic: "val.town'",
        children: [ [Object] ]
      },
      comments: [
        { name: "cfws", tokens: " ", semantic: "", children: [Array] }
      ]
    },
    type: "mailbox",
    name: null,
    address: "tom@val.town'",
    local: "tom",
    domain: "val.town'",
    comments: "",
    groupName: null
  }
]

Migrated from folder: email/parse_email

Code
README.md
S
main.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.