address-rfc2822

RFC 2822 & 5322 (Header) email address parser

MIT 18 个版本
安装
npm install address-rfc2822
yarn add address-rfc2822
pnpm add address-rfc2822
bun add address-rfc2822
README

NOTICE, DEPRECATED

This module is superseded by @haraka/email-address. New projects should use @haraka/email-address instead. (ref haraka/Haraka#3564)


Build Status Code Climate Coverage Status

address-rfc2822

Parser for RFC 2822 & 5322 (Header) format email addresses.

This module parses RFC 2822 headers containing addresses such as From, To, CC, and BCC headers.

It is almost a direct port of the perl module Mail::Address and I'm grateful to the original authors of that module for the clean code and the tests.

Installation

npm install address-rfc2822

Usage

const addrparser = require('address-rfc2822')

const addresses = addrparser.parse('Matt Sergeant <helpme+npm@gmail.com>')
const address = addresses[0]

console.log(`Email address: ${address.address}`) // helpme+npm@gmail.com
console.log(`Email name: ${address.name()}`)     // Matt Sergeant
console.log(`Reformatted: ${address.format()}`)  // Matt Sergeant <helpme+npm@gmail.com>
console.log(`User part: ${address.user()}`)      // helpme+npm
console.log(`Host part: ${address.host()}`)      // gmail.com

More Info

License

This module is MIT licensed.

版本列表
2.2.4 2026-05-24
2.2.3 2025-01-13
2.2.2 2024-04-29
2.2.1 2024-04-08
2.2.0 2024-02-23
2.1.0 2021-02-26
2.0.6 2020-11-18
2.0.5 2020-06-03
2.0.4 2018-06-30
2.0.3 2018-03-01
2.0.2 2018-02-25
2.0.1 2017-06-26
2.0.0 2017-06-21
1.0.1 2016-09-23
1.0.0 2016-02-24
0.0.2 2013-05-02
0.0.1 2013-03-15
0.0.0 2013-03-15