The Email Address Validation Library
C Makefile Perl
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
data
docs
include
src
tests
util
.gitignore
LICENSE
LICENSE.postfix
Makefile
README.md
TODO

README.md

libeav - Email Address Validation Library

Description

This is a library which validates an Email Address. I do my best to support all existing RFCs:

A quick note about RFC 6531: it is possible that the correct implementation SHOULD take into account RFC 20 to exclude some characters: "#", "`", "{", "}", "|", "~" and "^". I did it, but you may change this in the way you would like (see the is_6531_local.c file).

What it does not

You have to be NOT mistaken about the definition of Email Address. This software does NOT implement (at the moment, at least) a full support of Address Specification.

All that this software does it is validating of the Addr-Spec Specification. See details below:

address = mailbox / group
mailbox = name-addr / addr-spec
addr-spec = local-part "@" domain

Features

  • UTF-8 / IDNA2008 support
  • FQDN & TLD check (configurable)
  • Local-Part & Domain length check

Dependencies

Thread-safety

The library SHOULD be thread-safe. Not tested yet.

Documentation

The documentation may be found either in docs directory or after installing this library via man command:

shell> man libeav

Build

First of all, you have to specify the directory where idnkit was installed. To do this you have two options:

  • Export the IDNKIT_DIR environment variable as showed below.
  • Manually change paths in Makefiles.

The library assumes that idnkit was installed in /usr/local by default.

Secondly, if you planning to install the library to non-standard directory you may change the destination directory by setting DESTDIR variable manually. The default value of DESTDIR is /usr/local.

shell> export INDKIT_DIR=/home/user/local
shell> make
shell> make check
shell> make install DESTDIR=/path/to/install

Tools

There is an utility called eav. It will be installed by default to the DESTDIR/bin directory. It has a simple usage:

shell> eav emails1.txt emails2.txt

See its sources in the bin directory.

The sample output is:

FAIL: localpart-only
      email has no domain part
PASS: i.have.only.ipv4@[8.8.8.8]
PASS: this-is.ipv6@[IPv6:2001:0db8:0000:0000:0000:ff00:0042:8329]
PASS: and.this.is.ipv6-ipv4@[IPv6:::ffff:192.0.2.128]
FAIL: invalid.ipv4@[0.1.2.3]
      invalid ip address
FAIL: invalid.ipv6@[IPv6:ge80:1::]
      invalid ip address
PASS: valid.ipv6@[IPv6:2001:db8:0:1:1:1:1:1]
PASS: legacy.valid.ipv6@[IPv6:2001:db8::1:1:1:1:1]
PASS: xxx.ipv6@[2001:db8:1:1:1:1:1:1]
PASS: simple@test.com

Credits

License

This software is released under BSD 2-clause "Simplified" License.