RFC 2822 & 5322 (Header) email address parser
npm install address-rfc2822[![Build Status][ci-img]][ci-url]
[![Code Climate][clim-img]][clim-url]
[![Coverage Status][cov-img]][cov-url]
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.
npm install address-rfc2822
``js
const addrparser = require('address-rfc2822')
const addresses = addrparser.parse('Matt Sergeant
const address = addresses[0]
console.log(Email address: ${address.address}) // helpme+npm@gmail.comEmail name: ${address.name()}
console.log() // Matt SergeantReformatted: ${address.format()}
console.log() // Matt Sergeant User part: ${address.user()}
console.log() // helpme+npmHost part: ${address.host()}
console.log() // gmail.com``
This module is MIT licensed.
[ci-img]: https://github.com/haraka/node-address-rfc2822/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/haraka/node-address-rfc2822/actions/workflows/ci.yml
[cov-img]: https://codecov.io/github/haraka/node-address-rfc2822/coverage.svg
[cov-url]: https://codecov.io/github/haraka/node-address-rfc2822?branch=master
[clim-img]: https://codeclimate.com/github/haraka/haraka-plugin-template/badges/gpa.svg
[clim-url]: https://codeclimate.com/github/haraka/haraka-plugin-template