An open API service indexing awesome lists of open source software.

https://github.com/eser/sanitizer-svc

provides email address validation, sanitization, and disposable email detection
https://github.com/eser/sanitizer-svc

disposable-emails email fraud-detection fraud-prevention golang sanitizer validator

Last synced: about 1 year ago
JSON representation

provides email address validation, sanitization, and disposable email detection

Awesome Lists containing this project

README

          

# Email Sanitizer Service

A lightweight HTTP service that provides email address validation, sanitization, and disposable email detection.

## Features

- Email validation using regex pattern
- Email sanitization (lowercase, whitespace removal, plus addressing removal)
- Disposable email domain detection
- Simple REST API interface

## Getting Started

### Prerequisites

- Go 1.x or higher
- A disposable email blocklist file (provided as `disposable_email_blocklist.conf`)

### Installation

```bash
git clone https://github.com/eser/sanitizer-svc.git
cd sanitizer-svc
go build
```

## Usage

1. Start the server:
```bash
./sanitizer-svc
```

The server will start on port 8080.

### API Endpoint

#### GET /sanitize

Validates, sanitizes, and checks if an email address is from a disposable domain.

**Query Parameters:**
- `email` (required): The email address to process

**Response:**
```json
{
"isValid": true,
"sanitized": "johndoe@example.com",
"isDisposable": false
}
```

**Example Usage:**
```bash
curl "http://localhost:8080/sanitize?email=John.Doe+alias@Example.com"
```

### Sanitization Rules

The service applies the following sanitization rules:
- Converts email to lowercase
- Removes whitespace
- Removes plus addressing (e.g., `user+alias@domain.com` → `user@domain.com`)
- Removes dots from the local part (e.g., `john.doe@domain.com` → `johndoe@domain.com`)

## License

Apache 2.0

## Thanks

Thanks to [disposable-email-domains](https://github.com/disposable-email-domains/disposable-email-domains) project for providing the blocklist and making it available under Public Domain.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.