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
- Host: GitHub
- URL: https://github.com/eser/sanitizer-svc
- Owner: eser
- License: other
- Created: 2025-01-07T08:52:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-07T08:52:38.000Z (over 1 year ago)
- Last Synced: 2025-04-13T08:08:21.769Z (about 1 year ago)
- Topics: disposable-emails, email, fraud-detection, fraud-prevention, golang, sanitizer, validator
- Language: Go
- Homepage:
- Size: 21.5 KB
- Stars: 20
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.