Detect disposable email addresses in real-time with the TempMailChecker API. Block fake signups, prevent spam, and protect your platform from abuse.
pip install tempmailchecker
# or
pip3 install tempmailcheckerfrom tempmailchecker import TempMailChecker
# Initialize with your API key
checker = TempMailChecker('your_api_key_here')
# Check if an email is disposable
if checker.is_disposable('user@tempmail.com'):
print('Blocked: This is a disposable email')
else:
print('Valid: This is a legitimate email')checker = TempMailChecker('your_api_key')
# Simple boolean check
is_disposable = checker.is_disposable('test@10minutemail.com')
# Get full response
result = checker.check('user@example.com')
# Returns: {'temp': False}# Check just the domain
is_disposable = checker.is_disposable_domain('tempmail.com')
# Get full response
result = checker.check_domain('guerrillamail.com')Use regional endpoints for lower latency. All endpoints use /check and /usage directly (no /api prefix):
from tempmailchecker import TempMailChecker, ENDPOINT_EU, ENDPOINT_US, ENDPOINT_ASIA
# EU endpoint (default)
checker = TempMailChecker('your_api_key')
# or explicitly:
checker = TempMailChecker('your_api_key', endpoint=ENDPOINT_EU)
# US endpoint
checker = TempMailChecker('your_api_key', endpoint=ENDPOINT_US)
# Asia endpoint
checker = TempMailChecker('your_api_key', endpoint=ENDPOINT_ASIA)usage = checker.get_usage()
# Returns: {'usage_today': 15, 'limit': 25, 'reset': 'midnight UTC'}from tempmailchecker import TempMailChecker
from requests.exceptions import RequestException
try:
is_disposable = checker.is_disposable('user@example.com')
except RequestException as e:
if 'Rate limit' in str(e):
# Handle rate limit
pass
else:
# Handle other errors
print(f'Error: {e}')- Block Fake Signups: Stop disposable emails at registration
- Prevent Promo Abuse: Protect referral programs and coupons
- Clean Email Lists: Remove throwaway addresses from newsletters
- Reduce Spam: Filter out disposable emails in contact forms
- Protect Communities: Ensure real users in forums and chat
- β Simple API: One method call, one boolean response
- β Fast: Sub-millisecond processing, ~70ms real-world latency
- β Massive Database: 277,000+ disposable email domains
- β Auto-Updates: Database updated daily automatically
- β Regional Endpoints: US, EU, and Asia for optimal performance
- β Type Hints: Full type annotations included
- β Free Tier: 25 requests/day, no credit card required
- Sign up at tempmailchecker.com
- Get 25 free requests per day
- Start blocking disposable emails immediately
from django.core.exceptions import ValidationError
from tempmailchecker import TempMailChecker
def validate_email_not_disposable(email):
checker = TempMailChecker(settings.TEMPMAILCHECKER_API_KEY)
try:
if checker.is_disposable(email):
raise ValidationError('Disposable email addresses are not allowed')
except RequestException:
# Fail open - allow email on API error
passfrom flask import Flask, request, jsonify
from tempmailchecker import TempMailChecker
app = Flask(__name__)
checker = TempMailChecker(os.getenv('TEMPMAILCHECKER_API_KEY'))
@app.route('/signup', methods=['POST'])
def signup():
email = request.json.get('email')
try:
if checker.is_disposable(email):
return jsonify({'error': 'Disposable email not allowed'}), 400
except RequestException as e:
# Log error but allow signup
app.logger.warning(f'TempMailChecker error: {e}')
# Proceed with signup
return jsonify({'success': True})from fastapi import FastAPI, HTTPException
from pydantic import EmailStr
from tempmailchecker import TempMailChecker
app = FastAPI()
checker = TempMailChecker(os.getenv('TEMPMAILCHECKER_API_KEY'))
@app.post('/signup')
async def signup(email: EmailStr):
try:
if checker.is_disposable(email):
raise HTTPException(status_code=400, detail='Disposable email not allowed')
except RequestException:
# Fail open
pass
return {'success': True}- Python 3.7 or higher
- requests library (installed automatically)
This library is open-source software licensed under the MIT License.
- Documentation: tempmailchecker.com/docs
- Issues: GitHub Issues
- Email: support@tempmailchecker.com
- 277,000+ domains in our database
- Sub-millisecond API processing
- ~70ms latency from global endpoints
- Auto-updates daily
- Free tier with 25 requests/day
- Simple Python API - no complex dependencies
Made with β€οΈ by TempMailChecker
