address-rfc2822
v2.2.2
Published
RFC 2822 & 5322 (Header) email address parser
Downloads
21,865
Readme
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 <[email protected]>')
const address = addresses[0]
console.log(`Email address: ${address.address}`) // [email protected]
console.log(`Email name: ${address.name()}`) // Matt Sergeant
console.log(`Reformatted: ${address.format()}`) // Matt Sergeant <[email protected]>
console.log(`User part: ${address.user()}`) // helpme+npm
console.log(`Host part: ${address.host()}`) // gmail.com
More Info
License
This module is MIT licensed.