2.0.13 • Published 8 months ago

reserved-email-addresses-list v2.0.13

Weekly downloads
30
License
MIT
Repository
github
Last release
8 months ago

reserved-email-addresses-list

build status code style styled with prettier made with lass license npm downloads

List of 1250+ generic, admin, mailer-daemon, and no-reply usernames reserved for security concerns. Made for Forward Email.

Table of Contents

Install

npm:

npm install reserved-email-addresses-list email-addresses

Usage

The string you are comparing with must be converted to lowercase and trimmed of whitespace. The reason we are converting to lowercase is because the dictionary of words we are comparing with are all lowercase, and in order to compare for strict equality, we must have matching case.

It is also highly recommended that you check for strict equality, and for a list of admin, mailer-daemon, and no-reply usernames, you should check for strict equality, starts with, or ends with comparisons as well.

const reservedEmailAddressesList = require('reserved-email-addresses-list');
const reservedAdminList = require('reserved-email-addresses-list/admin-list.json');
const emailAddresses = require('email-addresses');

const email = '"Admin***!!!"@example.com';
const parsed = emailAddresses.parseOneAddress(email);

if (parsed === null) throw new Error('Email was not a valid address');

const str = parsed.local.toLowerCase();

let reservedMatch = reservedEmailAddressesList.find(addr => addr === str);

if (!reservedMatch)
  reservedMatch = reservedAdminList.find(
    addr => addr === str || str.startsWith(addr) || str.endsWith(addr)
  );

if (reservedMatch)
  throw new Error(
    'User must be a domain admin to create an alias with a reserved word (see https://forwardemail.net/reserved-email-addresses).'
  );

Lists

Formats

The default list index.json itself comes in a few different formats. The default import is an Array, but also available are a Map and Set version of the list.

// Array version
const reservedEmailAddressesList = require('reserved-email-addresses-list');
// Also available with: require('reserved-email-addresses-list/array');

// Map version
const reservedEmailAddressesMap = require('reserved-email-addresses-list/map');

// Set version
const reservedEmailAddressesSet = require('reserved-email-addresses-list/set');

If you would like to create a Map or Set version of the other lists, simply require them first, and then convert to a Set or Map (see map.cjs, set.cjs, and other files in this repo for more insight how to do this).

References

Contributors

NameWebsite
Nick Baughhttp://niftylettuce.com/

License

MIT © Nick Baugh

2.0.13

8 months ago

1.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.11

1 year ago

2.0.7

1 year ago

2.0.12

12 months ago

2.0.6

1 year ago

2.0.9

1 year ago

2.0.10

1 year ago

2.0.8

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.3

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.9

3 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago