A stateless REST API service that validates email addresses in real-time using external validation services.
- Real-time email validation
- Basic syntax validation
- Disposable email detection
- Free email provider detection
- RESTful API endpoints
- CORS enabled
- No data storage (completely stateless)
- Go 1.21 or higher
- Mailboxlayer API key (sign up at https://mailboxlayer.com)
- Clone the repository:
git clone <repository-url>
cd tempmailblock- Copy the environment file and add your API keys:
cp .env.example .env- Edit
.envand add your API keys:
MAILBOXLAYER_API_KEY=your_key_here
PORT=8080
- Install dependencies:
go mod download- Run the server:
go run main.goGET /validate?email=test@example.com
{
"email": "test@example.com",
"is_valid": true,
"provider": "example.com",
"is_free": false,
"is_disposable": false
}GET /health
{
"status": "healthy"
}The API returns appropriate HTTP status codes and error messages:
- 200: Successful validation
- 400: Missing or invalid parameters
- 500: Internal server error or external API failure
- API keys are stored in environment variables
- CORS is enabled but can be configured as needed
- Rate limiting should be implemented in production
- Use HTTPS in production
MIT License