This project provides a structured email validation script written in Python.
It improves upon simple checks (like just searching for @ and .) by applying multiple
rules to accurately determine whether an email address is correctly formatted.
- Ensures
.appears after@. - Prevents invalid formats like:
abc.gmail@com@gmail.comabc@gmail.
- Local part (before @) must not be empty.
- Domain must have a valid extension (like
.com,.in,.org).
- Strips leading/trailing spaces.
- Converts email to lowercase.
- Detects consecutive dots such as
abc..xyz@gmail.com.
Instead of printing just “invalid”, the validator explains why the email is invalid.
A hybrid approach ensures both flexibility and safety.
✓ Email is valid!
@domain.com
✗ Email is invalid due to:
- Email must contain text before '@'.
- Email contains invalid characters or structure.
python email_validator.py