# spamguard.js

> 🤖 Protect your email address from being crawled by spam bots.

Latest version **4.4.1** (published 2022-10-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install spamguard.js
pnpm add spamguard.js
yarn add spamguard.js
bun add spamguard.js
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.4.1 |
| Published | 2022-10-12 |
| First published | 2021-11-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 19.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Maintainers | madeinhamburg |
| Keywords | anti-spam, email, hide email, obfuscate email, obfuscation, obfuscator, protection, spam |

## Links

- npm: https://www.npmjs.com/package/spamguard.js
- Repository: https://github.com/madeinhamburg/spamguard.js
- Issues: https://github.com/madeinhamburg/spamguard.js/issues
- npm.io page: https://npm.io/package/spamguard.js

## 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

- 4.4.1 (latest) — 2022-10-12
- 4.4.0 — 2022-02-28
- 4.3.0 — 2021-12-07
- 4.2.0 — 2021-12-07
- 4.1.0 — 2021-11-29
- 4.0.0 — 2021-11-28

## README

# spamguard.js





### Installation
```bash
npm install spamguard.js
yarn add spamguard.js
```





### Usage
```javascript
spamguard(selector);
```

```html
<script src="https://cdn.jsdelivr.net/npm/spamguard.js/dist/spamguard.js"></script>
<a href="#" class="obfuscate-it" data-name="mark" data-domain="gmail" data-tld="com" data-mailto="true"></a>
<script>
	spamguard(".obfuscate-it");
</script>
```

[Demo](https://madeinhamburg.github.io/spamguard.js/example/index.html)





### Options
| Attribute | Type | Default | Description |
|---|---|---|---|
| `data-name` | `string` | | Everything before the `@` of your email address |
| `data-domain` | `string` | | Domain name without extension |
| `data-tld` | `string` | | Extension without `.` |
| `data-salt` | `string` | | Additional characters for confusion, which are removed |
| `data-number` | `string` | | You can add letters and special characters for obfuscation (see example) |
| `data-mailto` | `boolean` | false | Creates a `mailto:`-link |
| `data-content` | `boolean` | false | When `true`, your own content will be kept. Otherwise it returns the email address. |
| `data-subject` | `string` | | Set a custom subject for `mailto:`-link |
| `data-message` | `string` | | Set a custom message for `mailto:`-link |
| `data-text` | `string` | | Obfuscate a custom string |
| `data-protocol` | `string` | tel | Set the protocol on `data-number`: `whatsapp`, `tel`, `sms`  |
| `data-align-content` | `string` | left | Correspond to justify-content |





### Example with custom content

```html
<a href="#" class="obfuscate-it" data-name="mark" data-domain="gmail" data-tld="com" data-mailto="true" data-content="true">
	<i class="fa fa-heart"></i>
</a>
<script>
	spamguard(".obfuscate-it");
</script>
```

### Example with phone number

```html
<a href="#" class="obfuscate-it" data-number="_+1 $&80=8 :555;; 01-))23" data-salt="§$%&/()=_:;.-[]" data-mailto="true"></a>
<script>
	spamguard(".obfuscate-it");
</script>
```

### Example with WhatsApp number

```html
<a href="#" class="obfuscate-it" data-number="_+1 $&80=8 :555;; 01-))23" data-salt="§$%&/()=_:;.-[]" data-protocol="whatsapp" data-message="Hi there!" data-mailto="true"></a>
<script>
	spamguard(".obfuscate-it");
</script>
```

### Example with a custom text

```html
<span class="obfuscate-it" data-text="H$e__l-[l].o ::W=o)r%&%ld.!" data-salt="§$%&/()=_:;.-[]"></span>
<script>
	spamguard(".obfuscate-it");
</script>
```

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