If you were sent here by a customer, your application has a bug.
It is rejecting valid email addresses. The information below explains the problem and how to fix it.
.RICOH
is a valid generic top-level domain (gTLD)
Your customer tried to use an email address like [email protected] and your application rejected it. This extension has been valid since 2014 and is one of 1,321 gTLDs recognized by IANA for use in domain names and email addresses.
Extensions like .RICOH are newer versions of the classic .COM and .NET domains. Not supporting them means you're likely turning away other customers too — forcing them to restart signup with a different email or abandon your service entirely.
Why does this happen?
Most of the time, this is caused by one of a few common mistakes in how the website checks whether an email address is valid:
- Only allowing a short list of known extensions — the website was programmed to only accept email addresses ending in
.com,.net,.org, and a handful of others. Anything outside that list — including.RICOH— gets rejected even though it's perfectly valid. - Limiting how long the extension can be — the website's code assumes the part after the last dot (like "com" or "net") can only be 2 to 4 characters long. Extensions like
.RICOHare longer than that, so they get incorrectly rejected. - Using an outdated validation library — the website relies on a third-party tool or plugin to check email addresses, but that tool hasn't been updated to recognize the newer extensions that have been available since 2014.
How to fix it
Use your language or framework's built-in email validation instead of writing your own regex. The examples below show the correct approach for every major language and framework.
Avoid writing your own regular expression for email validation — it is almost always wrong and is the #1 cause of gTLD rejection.
DNS Validation
The most reliable way to validate an email address is to check if the domain has a valid MX record. If the domain has no MX record, no mail can be delivered to it.
Language Examples
Use the type="email" attribute. The browser validates against the RFC spec and accepts all valid TLDs.
<input type="email" name="email" required>
Use filter_var() with FILTER_VALIDATE_EMAIL. This follows the RFC spec and does not restrict TLD length or format.
$valid = filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
Use the email-validator package for robust validation with optional DNS checks. For basic parsing, the standard library's email.utils.parseaddr() also works.
from email_validator import validate_email
result = validate_email("[email protected]")
Avoid writing a custom regex. Use the browser's built-in <input type="email"> constraint validation, or use validator.js on the server.
import validator from 'validator';
validator.isEmail('[email protected]'); // true
Use the built-in URI::MailTo::EMAIL_REGEXP constant which follows the RFC spec and accepts all valid TLDs.
valid = email.match?(URI::MailTo::EMAIL_REGEXP)
Use jakarta.mail.internet.InternetAddress which parses per RFC 822, or the @Email annotation from Hibernate Validator.
import jakarta.mail.internet.InternetAddress;
InternetAddress addr = new InternetAddress(email);
addr.validate();
Use System.Net.Mail.MailAddress which parses per RFC spec, or the [EmailAddress] data annotation for model validation.
try {
var addr = new System.Net.Mail.MailAddress(email);
bool valid = addr.Address == email;
} catch (FormatException) {
// invalid
}
Use the standard library's net/mail.ParseAddress() which parses addresses per RFC 5322.
import "net/mail"
_, err := mail.ParseAddress(email)
valid := err == nil
Use NSDataDetector with the .link checking type to validate email addresses without restrictive regex.
import Foundation
let detector = try NSDataDetector(
types: NSTextCheckingResult.CheckingType.link.rawValue
)
let range = NSRange(email.startIndex..<email.endIndex, in: email)
let match = detector.firstMatch(in: email, options: [], range: range)
let valid = match?.url?.scheme == "mailto"
On Android use Patterns.EMAIL_ADDRESS. On the JVM, use InternetAddress from Jakarta Mail.
// Android
val valid = android.util.Patterns.EMAIL_ADDRESS
.matcher(email).matches()
// JVM
val addr = jakarta.mail.internet.InternetAddress(email)
addr.validate()
Use the email_address crate which validates against RFC 5321.
use email_address::EmailAddress;
let valid = EmailAddress::is_valid("[email protected]");
Use the email_checker package or Ecto changeset validation.
# Ecto changeset
validate_format(changeset, :email, ~r/^[^\s]+@[^\s]+\.[^\s]+$/)
Framework Examples
Use the email validation rule. The rfc and dns options provide additional checks.
$request->validate([
'email' => 'required|email:rfc,dns',
]);
Use the Email constraint with the desired validation mode.
use Symfony\Component\Validator\Constraints as Assert;
#[Assert\Email(mode: 'strict')]
private string $email;
Use the built-in EmailValidator or EmailField on forms and models.
# In a model
from django.db import models
email = models.EmailField()
# In a form
from django.core.validators import validate_email
validate_email('[email protected]')
Use the Email validator from WTForms which checks RFC compliance.
from wtforms import StringField
from wtforms.validators import Email
class MyForm(FlaskForm):
email = StringField('Email', validators=[Email()])
Use the built-in URI::MailTo::EMAIL_REGEXP with a model validation.
class User < ApplicationRecord
validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }
end
Use the @Email annotation from Jakarta Bean Validation (Hibernate Validator).
import jakarta.validation.constraints.Email;
public class UserDTO {
@Email
private String email;
}
Use the [EmailAddress] data annotation on your model properties.
using System.ComponentModel.DataAnnotations;
public class UserModel {
[Required]
[EmailAddress]
public string Email { get; set; }
}
Use express-validator which wraps validator.js for RFC-compliant checks.
import { body } from 'express-validator';
app.post('/register',
body('email').isEmail(),
(req, res) => { /* ... */ }
);
Use the built-in Validators.email which follows the HTML5 email spec.
import { Validators } from '@angular/forms';
this.form = this.fb.group({
email: ['', [Validators.required, Validators.email]]
});
Use Ecto changeset validations to check email format.
def changeset(user, attrs) do
user
|> cast(attrs, [:email])
|> validate_required([:email])
|> validate_format(:email, ~r/^[^\s]+@[^\s]+\.[^\s]+$/)
end
Use native HTML5 email input for client-side validation. For API routes, use validator.js.
// Client-side (React component)
<input type="email" name="email" required />
// Server-side (API route)
import validator from 'validator';
if (!validator.isEmail(req.body.email)) {
return res.status(400).json({ error: 'Invalid email' });
}
Use Vuelidate's built-in email validator.
import { required, email } from '@vuelidate/validators';
const rules = {
email: { required, email }
};
Use the binding:"email" struct tag which validates using the go-playground/validator package.
type RegisterInput struct {
Email string `json:"email" binding:"required,email"`
}