gtld.fyi TLD Directory

website·Indexed 30 days ago

https://gtld.fyi/

A directory of Generic Top-Level Domains (gTLDs) providing information on various TLDs and guidance for developers whose applications may be incorrectly rejecting valid email addresses using these extensions.

Tokens
1.2M
Snippets
7K
Records
8.4K
Agent score
40%

What's inside gtld.fyi

  1. Perform reliable email validation via DNS

    The most reliable method to validate an email address is to verify that the domain has a valid MX (Mail Exchange) record. If no MX record exists, mail cannot be delivered to that domain regardless of the TLD's validity.
  2. Perform high-reliability email validation via DNS

    The most reliable method to validate an email address is to verify that the domain has a valid MX (Mail Exchanger) record. If no MX record exists, mail cannot be delivered to that domain, regardless of whether the string format is RFC-compliant.
  3. Validate email addresses in various programming languages

    Use the following RFC-compliant methods to validate email addresses across different languages to ensure support for all gTLDs.
    <!-- HTML -->
    <input type="email" name="email" required>
    // PHP
    $valid = filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
    # Python
    from email_validator import validate_email
    result = validate_email("user@example.nowruz")
    // JS / TS
    import validator from 'validator';
    validator.isEmail('user@example.nowruz'); // true
    # Ruby
    valid = email.match?(URI::MailTo::EMAIL_REGEXP)
    // Java
    import jakarta.mail.internet.InternetAddress;
    InternetAddress addr = new InternetAddress(email);
    addr.validate();
    // C#
    try {
        var addr = new System.Net.Mail.MailAddress(email);
        bool valid = addr.Address == email;
    } catch (FormatException) { /* invalid */ }
    // Go
    import "net/mail"
    _, err := mail.ParseAddress(email)
    valid := err == nil
    // Swift
    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"
    // Kotlin (Android)
    val valid = android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()
    // Rust
    use email_address::EmailAddress;
    let valid = EmailAddress::is_valid("user@example.nowruz");
    # Elixir (Ecto)
    validate_format(changeset, :email, ~r/^[^\s]+@[^\s]+\.[^\s]+$/)
  4. Validate email addresses in HTML, PHP, Python, and JavaScript

    Use built-in tools and libraries to ensure RFC-compliant email validation across different environments.
    <!-- HTML: Browser validates against RFC spec -->
    <input type="email" name="email" required>
    // PHP: Use filter_var with FILTER_VALIDATE_EMAIL
    $valid = filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
    # Python: Use email-validator package
    from email_validator import validate_email
    result = validate_email("user@example.ga")
    // JS/TS: Use validator.js on the server
    import validator from 'validator';
    validator.isEmail('user@example.ga'); // true
  5. Avoid custom regex for email validation to support gTLDs like .NAB

    Many applications incorrectly reject valid email addresses ending in newer generic top-level domains (gTLDs) like .NAB because they use restrictive custom regular expressions. Common mistakes include allowing only a short list of known extensions (e.g., .com, .net), limiting the TLD length to 2-4 characters, or using outdated validation libraries. To ensure compatibility with all IANA-recognized gTLDs, use built-in language or framework validation tools that follow RFC specifications.
  6. Validate email addresses using web frameworks

    Implement RFC-compliant email validation using these framework-specific patterns to avoid rejecting newer gTLDs.
    // Laravel
    $request->validate(['email' => 'required|email:rfc,dns']);
    
    // Symfony
    use Symfony\Component\Validator\Constraints as Assert;
    #[Assert\Email(mode: 'strict')]
    private string $email;
    # Django
    from django.db import models
    email = models.EmailField()
    
    # Flask (WTForms)
    from wtforms import StringField
    from wtforms.validators import Email
    class MyForm(FlaskForm):
        email = StringField('Email', validators=[Email()])
    # Rails
    class User < ApplicationRecord
      validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }
    end
    // Spring (Jakarta Bean Validation)
    import jakarta.validation.constraints.Email;
    public class UserDTO {
        @Email
        private String email;
    }
    // ASP.NET
    using System.ComponentModel.DataAnnotations;
    public class UserModel {
        [Required]
        [EmailAddress]
        public string Email { get; set; }
    }
    // Express (express-validator)
    import { body } from 'express-validator';
    app.post('/register', body('email').isEmail(), (req, res) => { /* ... */ });
    
    // Angular
    import { Validators } from '@angular/forms';
    this.form = this.fb.group({
      email: ['', [Validators.required, Validators.email]]
    });
    
    // Vue.js (Vuelidate)
    import { required, email } from '@vuelidate/validators';
    const rules = { email: { required, email } };
    # Phoenix (Ecto)
    def changeset(user, attrs) do
      user
      |> cast(attrs, [:email])
      |> validate_required([:email])
      |> validate_format(:email, ~r/^[^\s]+@[^\s]+\.[^\s]+$/)
    end
    // Gin (go-playground/validator)
    type RegisterInput struct {
        Email string `json:"email" binding:"required,email"`
    }
  7. Validate emails using language-standard libraries

    Use the following language-specific implementations to ensure RFC-compliant email validation that supports all valid gTLDs.
    <!-- HTML5 -->
    <input type="email" name="email" required>
    // PHP
    $valid = filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
    # Python
    from email_validator import validate_email
    result = validate_email("user@example.pizza")
    // JS / TS
    import validator from 'validator';
    validator.isEmail('user@example.pizza'); // true
    # Ruby
    valid = email.match?(URI::MailTo::EMAIL_REGEXP)
    // Java
    import jakarta.mail.internet.InternetAddress;
    InternetAddress addr = new InternetAddress(email);
    addr.validate();
    // C#
    try {
        var addr = new System.Net.Mail.MailAddress(email);
        bool valid = addr.Address == email;
    } catch (FormatException) { /* invalid */ }
    // Go
    import "net/mail"
    _, err := mail.ParseAddress(email)
    valid := err == nil
    // Swift
    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"
    // Kotlin (Android)
    val valid = android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()
    
    // Kotlin (JVM)
    val addr = jakarta.mail.internet.InternetAddress(email)
    addr.validate()
    // Rust
    use email_address::EmailAddress;
    let valid = EmailAddress::is_valid("user@example.pizza");
    # Elixir (Ecto changeset)
    validate_format(changeset, :email, ~r/^[^  ]+@[^  ]+\.[^  ]+$/)
  8. Validate email addresses using language-specific libraries

    The most reliable way to validate an email address is to check for a valid MX record via DNS. If that is not possible, use the following RFC-compliant methods for your language:
    <!-- HTML -->
    <input type="email" name="email" required>
    // PHP
    $valid = filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
    # Python
    from email_validator import validate_email
    result = validate_email("user@example.im")
    // JS / TS
    import validator from 'validator';
    validator.isEmail('user@example.im'); // true
    # Ruby
    valid = email.match?(URI::MailTo::EMAIL_REGEXP)
    // Java
    import jakarta.mail.internet.InternetAddress;
    InternetAddress addr = new InternetAddress(email);
    addr.validate();
    // C#
    try {
        var addr = new System.Net.Mail.MailAddress(email);
        bool valid = addr.Address == email;
    } catch (FormatException) { /* invalid */ }
    // Go
    import "net/mail"
    _, err := mail.ParseAddress(email)
    valid := err == nil
    // Swift
    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"
    // Kotlin (Android)
    val valid = android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()
    
    // Kotlin (JVM)
    val addr = jakarta.mail.internet.InternetAddress(email)
    addr.validate()
    // Rust
    use email_address::EmailAddress;
    let valid = EmailAddress::is_valid("user@example.im");
    # Elixir (Ecto)
    validate_format(changeset, :email, ~r/^[^\s]+@[^\s]+\.[^\s]+$/)
  9. Validate emails in Elixir and Ecto

    Use the email_checker package or Ecto changeset validation to verify email formats.
    # Ecto changeset validation
    def changeset(user, attrs) do
      user
      |> cast(attrs, [:email])
      |> validate_required([:email])
      |> validate_format(:email, ~r/^[^\s]+@[^\s]+\.[^\s]+$/)
    end
  10. Validate emails using RFC-compliant methods in various languages

    Use these language-specific implementations to ensure all valid gTLDs, including .HANGOUT, are accepted.
    <!-- HTML5 -->
    <input type="email" name="email" required>
    // PHP
    $valid = filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
    # Python
    from email_validator import validate_email
    result = validate_email("user@example.hangout")
    // JS / TS
    import validator from 'validator';
    validator.isEmail('user@example.hangout'); // true
    # Ruby
    valid = email.match?(URI::MailTo::EMAIL_REGEXP)
    // Java
    import jakarta.mail.internet.InternetAddress;
    InternetAddress addr = new InternetAddress(email);
    addr.validate();
    // C#
    try {
        var addr = new System.Net.Mail.MailAddress(email);
        bool valid = addr.Address == email;
    } catch (FormatException) { /* invalid */ }
    // Go
    import "net/mail"
    _, err := mail.ParseAddress(email)
    valid := err == nil
    // Swift
    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"
    // Kotlin (Android)
    val valid = android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()
    // Rust
    use email_address::EmailAddress;
    let valid = EmailAddress::is_valid("user@example.hangout");
    # Elixir (Ecto)
    validate_format(changeset, :email, ~r/^[^\s]+@[^\s]+\.[^\s]+$/)
  11. Perform robust email validation via DNS

    The most reliable method to validate an email address is to check if the domain has a valid MX (Mail Exchange) record. If no MX record exists, mail cannot be delivered to that domain regardless of whether the syntax is correct.
  12. Validate email addresses in various programming languages

    Use these RFC-compliant methods to validate email addresses across different languages to ensure support for all gTLDs.
    <!-- HTML -->
    <input type="email" name="email" required>
    // PHP
    $valid = filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
    # Python
    from email_validator import validate_email
    result = validate_email("user@example.song")
    // JS / TS
    import validator from 'validator';
    validator.isEmail('user@example.song'); // true
    # Ruby
    valid = email.match?(URI::MailTo::EMAIL_REGEXP)
    // Java
    import jakarta.mail.internet.InternetAddress;
    InternetAddress addr = new InternetAddress(email);
    addr.validate();
    // C#
    try {
        var addr = new System.Net.Mail.MailAddress(email);
        bool valid = addr.Address == email;
    } catch (FormatException) { /* invalid */ }
    // Go
    import "net/mail"
    _, err := mail.ParseAddress(email)
    valid := err == nil
    // Swift
    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"
    // Kotlin (Android)
    val valid = android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()
    
    // Kotlin (JVM)
    val addr = jakarta.mail.internet.InternetAddress(email)
    addr.validate()
    // Rust
    use email_address::EmailAddress;
    let valid = EmailAddress::is_valid("user@example.song");
    # Elixir (Ecto)
    validate_format(changeset, :email, ~r/^[^\s]+@[^\s]+\.[^\s]+$/)