Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Files

Latest commit

 

History

History
80 lines (61 loc) · 2.32 KB

README.md

File metadata and controls

80 lines (61 loc) · 2.32 KB
  • infos = Information about the email plugin is in keys below
  • infos/author = Andreas Kraschitzer [email protected]
  • infos/licence = BSD
  • infos/needs =
  • infos/provides = check
  • infos/recommends =
  • infos/placements = presetstorage
  • infos/status = maintained unittest nodep experimental
  • infos/metadata = check/email
  • infos/description = Validation for email addresses

Email Address Validation

Introduction

This plugin validates email addresses using regular expressions. The plugin does not support the full RFC5321 spec. For more information see Limitations below.

Installation

See installation. The package is called libelektra5-experimental.

Usage

# Mount `email` plugin to cascading namespace `/tests/email`
kdb mount config.dump /tests/email dump email

# Incorrect address is valid with incomplete configuration
kdb meta-set /tests/email/noaddr check/email
kdb set /tests/email/noaddr invalid..address@com
# RET: 0

# Check the validity of the email stored in `/tests/email/adr`
kdb meta-set /tests/email/adr check/email ""

# Set a correct email address
kdb set /tests/email/adr [email protected]
kdb get /tests/email/adr
#> [email protected]

# Try to set incorrect addresses
kdb set /tests/email/adr invalid..address@com
# STDERR: .*Validation Semantic.*
# ERROR:  C03200
# RET: 5

kdb set /tests/email/adr [email protected]
# STDERR: .*Validation Semantic.*
# ERROR:  C03200
# RET: 5

kdb set /tests/email/adr @
# STDERR: .*Validation Semantic.*
# ERROR:  C03200
# RET: 5

# Undo modifications to the database
kdb rm -r /tests/email
kdb umount /tests/email

Limitations

The plugin only checks email addresses for validity. It is not able to resolve if the host and or check if the address can receive emails. The validation does not completely support the RFC5321. The following valid email addresses are not supported:

There is no validation of top level domains and no length check. The following invalid email addresses will be allowed:

  • valid+part@nonexistenttopleveldomain
  • 1234567890123456789012345678901234567890123456789012345678901234+x@example.com