Validating email addresses is essential for ensuring data accuracy, preventing errors in user input, and maintaining reliable communication channels. A well-formed email follows a structured format that includes an ”@” symbol, a valid domain name, and a top-level domain (TLD).

Incorrectly formatted email addresses can lead to:

  • Failed email deliveries – Invalid addresses may result in undelivered messages.
  • Security vulnerabilities – Malformed emails could be exploited in spam or phishing attempts.
  • Data inconsistencies – Incorrect entries can corrupt records in databases.

To ensure email validity, the “Is Email” evaluation is used to check whether the input text adheres to the standard email format using regex-based validation.

Click here to read the eval definition of Is Email


a. Using Interface

Required Inputs

  • text: The input string to be validated as an email address.

Output

Returns a Pass/Fail result, denoted by 1.0 and 0.0 respectively:

  • 1.0 – The text is a valid email address.
  • 0.0 – The text is not a properly formatted email.

b.Using SDK

from fi.testcases import TestCase
from fi.evals.templates import IsEmail

test_case = TestCase(
    text="john.doe@example"
)

template = IsEmail()
response = evaluator.evaluate(eval_templates=[template], inputs=[test_case])

print(f"Score: {response.eval_results[0].metrics[0].value}")