# server-accepts-email

> Check if an SMTP server accepts emails to a given address.

Latest version **1.11.1** (published 2018-07-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install server-accepts-email
pnpm add server-accepts-email
yarn add server-accepts-email
bun add server-accepts-email
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.11.1 |
| Published | 2018-07-25 |
| First published | 2018-05-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 8 |
| Unpacked size | 16.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | linusu |
| Keywords | check, email, existence, exists, smtp, validate, validation, validator, verify |

## Links

- npm: https://www.npmjs.com/package/server-accepts-email
- Repository: https://github.com/LinusU/server-accepts-email
- Homepage: https://github.com/LinusU/server-accepts-email#readme
- Issues: https://github.com/LinusU/server-accepts-email/issues
- npm.io page: https://npm.io/package/server-accepts-email

## Dependencies (8)

- [debug](https://npm.io/package/debug.md) ^3.1.0
- [p-limit](https://npm.io/package/p-limit.md) ^2.0.0
- [p-sleep](https://npm.io/package/p-sleep.md) ^1.1.0
- [p-timeout](https://npm.io/package/p-timeout.md) ^2.0.1
- [p-catch-if](https://npm.io/package/p-catch-if.md) ^1.0.2
- [async-lines](https://npm.io/package/async-lines.md) ^1.1.0
- [ts-semaphore](https://npm.io/package/ts-semaphore.md) ^1.0.0
- [ts-resource-pool](https://npm.io/package/ts-resource-pool.md) ^1.0.0-alpha.5

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.11.1 (latest) — 2018-07-25
- 1.11.0 — 2018-06-18
- 1.10.2 — 2018-06-13
- 1.10.1 — 2018-06-12
- 1.10.0 — 2018-06-12
- 1.9.1 — 2018-06-12
- 1.9.0 — 2018-06-11
- 1.8.1 — 2018-06-11
- 1.8.0 — 2018-06-11
- 1.7.0 — 2018-06-11
- 1.6.0 — 2018-06-08
- 1.5.0 — 2018-06-07
- 1.4.2 — 2018-06-04
- 1.4.1 — 2018-05-31
- 1.4.0 — 2018-05-31
- … 4 more at https://npm.io/package/server-accepts-email/versions

## README

# Server Accepts Email

Check if an SMTP server accepts emails to a given address.

## Installation

```sh
npm install --save server-accepts-email
```

## Usage

```js
const serverAcceptsEmail = require('server-accepts-email')

console.log(await serverAcceptsEmail('linus@folkdatorn.se'))
//=> true

console.log(await serverAcceptsEmail('6bJ4zsZHOE@folkdatorn.se'))
//=> false

console.log(await serverAcceptsEmail('linus@gp5uzpn2q7.se'))
//=> false
```

## API

### `serverAcceptsEmail(email[, options]) => Promise<boolean>`

- `email` (string, required) - Email address to test
- `options` (object, optional)
  - `senderDomain` (string, optional) - Domain to identify as (in `HELO` smtp command)
  - `senderAddress` (string, optional) - Email address to identify as (in `MAIL FROM` command)

## Other libraries

There are some other libraries that do the same thing, but I found them to have some flaws which made me write this one.

&nbsp; | Promise API | Follows [RFC5321](https://tools.ietf.org/html/rfc5321) <sup>1</sup> | Proper Errors <sup>2</sup> | Handles Greylisting <sup>3</sup> | Connection Pooling <sup>4</sup>
----- | :---: | :---: | :---: | :---: | :---:
**`server-accepts-email`** | ✅ | ✅ | ✅ | ✅ | ✅
[`email-exists`](https://github.com/MarkTiedemann/email-exists) | ✅ | ❌ | ❌ | ❌ | ❌
[`email-existence`](https://github.com/scippio/email-existence) | ❌ | ❌ | ❌ | ❌ | ❌
[`email-verify`](https://github.com/bighappyworld/email-verify) | ❌ | ❌ | ✅ | ❌ | ❌

<sup>1</sup> None of the other libraries parsed the replies to support multiline replies but instead relied on every reply coming in a chunk, accepting all data and searching for substrings, or something similar.

<sup>2</sup> Some of the other libraries rejects, or calls the callback, with something other than an `Error` instance.

<sup>3</sup> This library detects [Greylisting](https://en.wikipedia.org/wiki/Greylisting) and sends another request after the timeout has passed.

<sup>4</sup> This library reuses connections, and limits the number of simultaneous connections to any given host. This is more effecient, and the behaviour more closely matches that of proper SMTP clients, decreasing the chance of being blacklisted.

---
_Source: https://npm.io/package/server-accepts-email · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
