Prompt
check if email is valid before sending
Latest observation
Oct 5, 2026
OpenAI APIWeb search: off
Yes—before sending, you should validate the email address.
A practical approach is:
-
Basic format check
- Must contain one
@ - Must have a domain part after
@ - No spaces
- Example regex (simple, not perfect):
/^[^\s@]+@[^\s@]+\.[^\s@]+$/
- Must contain one
-
Trim whitespace
- Remove leading/trailing spaces before validating.
-
Optional domain checks
- Verify the domain has valid DNS/MX records if you need stronger validation.
-
Still handle send-time failures
- Even a “valid” email can bounce, so catch API/mail server errors.
If you want, I can give you:
- a JavaScript validation function,
- a Python one,
- or a more robust validation pattern.