Your friendly e-mail address validation library.

Overview

libvldmail Build Status

Your friendly e-mail address validation library.

Why?

  • Did you know that parentheses, spaces and - according to the RFC 6531 document - emojis can be a part of a valid e-mail address?
  • Did you know that both IPv6 addresses and resources in your intranet are valid parts of the part after the "@", so requiring a TLD (xxxx.yy) is entirely wrong?

Nor do all of the existing (and more complex than "is there an @ character?") validators I've come across. So this is my approach.

Features

  • Written in C for a "good enough" interoperability with other languages.
  • Does not depend on any non-standard library - no regex, no ICU, no other overhead.
  • Can validate e-mail addresses according to RFC 6531 with a fallback to RFC 5321 ff.
  • Will return both a "success" flag (0 or 1) and an error message. (See the Usage part for more information.)
  • Could probably wash your dishes (after having adequate code and hardware extensions).

A note on Unicode support

By default, libvldmail respects the latest internationalization standards, so Unicode characters are allowed in both the domain and the local part of the e-mail address you aim to have validated. If your service does not allow that, your service sucks and you should be ashamed. You can teach libvldmail to fall back to the good old ASCII days by defining the NO_UNICODE_MAIL_PLEASE preprocessor parameter.

A note on deprecation inside the RFCs

Things change. E-mail addresses do not necessarily have to. By default, valid e-mail addresses are recognized as valid even if the standards say that you should not use them anymore. If you compile libvldmail with the STRICT_VALIDATION preprocessor parameter, however, the library will mark more "deprecated" addresses as invalid.

Portability

You should be able to use libvldmail from inside Ruby, Python. Lisp etc. with the included SWIG template file (contrib/libvldmail.i).

Usage

#include <vldmail.h>

int main(void) {
    /* ... your code ... */
    
    vldmail validator = validate_email(L"[email protected]");
    if (0 == validator.success) {
        /* success == 0 means that something was wrong. */
        printf(L"Validating [email protected] failed: %ls\n", validator.message);
    }
    
    /* ... more of your code ... */
}

Building

Use CMake to create the libvldmail library, then link it into your application. And don't forget to point to the vldmail.h header.

Building the test file as well

By default, CMake does not build test.c which tries to test the library's basic functions. If you want to test libvldmail using it, please just pass the parameter BUILD_THE_TEST to CMake:

cmake . -DBUILD_THE_TEST=1

Versioning

libvldmail tries to follow the Semantic Versioning scheme. You can ask for the current version via the API:

printf("libvldmail version %d", VLDMAIL_VERSION);

We use simple mathematics here:

const int VLDMAIL_VERSION = 1;     // Version 0.0.1  (0 * 10^4 +  0 * 10^2 + 1 * 10^0)
const int VLDMAIL_VERSION = 21209; // Version 2.12.9 (2 * 10^4 + 12 * 10^2 + 9 * 10^0)

This should be enough.

Donations (optional)

libvldmail is free software by the terms of the WTFPL. As some people - including myself - like to contribute money for a good cause anyway, here are two possible options for you:

Donate money to the nature:

Both Kākāpō Recovery and the WWF do a pretty good job at trying to keep species alive. You are invited to join their efforts.

Donate money to me:

Yes, I like money as well.

Support via PayPal

Help me, please?

I accept pull requests if they are related to adding RFC-compatibility. This library seems to be working as intended, but - just like every other software - there might be quirks which I have not come across yet. You are invited to list yourself as a contributor below this paragraph if you need your merits:

Contributors

  • None, yet.
You might also like...
Standards compliant, fast, secure markdown processing library in C

Hoedown Hoedown is a revived fork of Sundown, the Markdown parser based on the original code of the Upskirt library by Natacha Porté. Features Fully s

CommonMark parsing and rendering library and program in C

cmark cmark is the C reference implementation of CommonMark, a rationalized version of Markdown syntax with a spec. (For the JavaScript reference impl

A cross-platform protocol library to communicate with iOS devices

libimobiledevice A library to communicate with services on iOS devices using native protocols. Features libimobiledevice is a cross-platform software

Platform independent Near Field Communication (NFC) library

*- * Free/Libre Near Field Communication (NFC) library * * Libnfc historical contributors: * Copyright (C) 2009 Roel Verdult * Copyright (C) 2009

A C library for parsing/normalizing street addresses around the world. Powered by statistical NLP and open geo data.
A C library for parsing/normalizing street addresses around the world. Powered by statistical NLP and open geo data.

libpostal: international street address NLP libpostal is a C library for parsing/normalizing street addresses around the world using statistical NLP a

A protocol buffers library for C

PBC PBC is a google protocol buffers library for C without code generation. Quick Example package tutorial; message Person { required string name =

An easy-to-use C library for displaying text progress bars.
An easy-to-use C library for displaying text progress bars.

What is this thing? progressbar is a C-class (it's a convention, dammit) for displaying attractive progress bars on the command line. It's heavily inf

Library for writing text-based user interfaces

IMPORTANT This library is no longer maintained. It's pretty small if you have a big project that relies on it, just maintain it yourself. Or look for

Locate the current executable and the current module/library on the file system

Where Am I? A drop-in two files library to locate the current executable and the current module on the file system. Supported platforms: Windows Linux

Owner
Cthulhux
Creator of BlogC++ and SublimeTodoTxt, knower of things. Hates Git.
Cthulhux
MMUit is a lightweight toolkit to explore and modify address translation for ARM64.

Overview MMUit is a lightweight toolkit to explore and modify address translation for ARM64. C/C++ interface detailed information on VA, TTE, TCR etc

Alexander Hude 37 Feb 13, 2022
A shebang-friendly script for "interpreting" single C99, C11, and C++ files, including rcfile support.

c99sh Basic Idea Control Files Shebang Tricks C++ C11 Credits Basic Idea A shebang-friendly script for "interpreting" single C99, C11, and C++ files,

Rhys Ulerich 100 Dec 3, 2022
WhyNotWin11 - Detection Script to help identify why your PC isn't Windows 11 ready

Detection Script to help identify why your PC isn't Windows 11 ready

Robert C. Maehl 5.9k Dec 28, 2022
A simple program to suspend or hibernate your computer

A simple program to suspend or hibernate your computer. It supports hooks before and after suspending.

Jakub Jirutka 13 Dec 30, 2022
Add colors to your program in C with umbrella.h

☂️ umbrella ☂️ Add colors to your program in C with umbrella.h Using in projects

Marcello Belanda 1 Jan 18, 2022
Isocline is a pure C library that can be used as an alternative to the GNU readline library

Isocline: a portable readline alternative. Isocline is a pure C library that can be used as an alternative to the GNU readline library (latest release

Daan 136 Dec 30, 2022
A linux library to get the file path of the currently running shared library. Emulates use of Win32 GetModuleHandleEx/GetModuleFilename.

whereami A linux library to get the file path of the currently running shared library. Emulates use of Win32 GetModuleHandleEx/GetModuleFilename. usag

Blackle Morisanchetto 3 Sep 24, 2022
Command-line arguments parsing library.

argparse argparse - A command line arguments parsing library in C (compatible with C++). Description This module is inspired by parse-options.c (git)

Yecheng Fu 533 Dec 26, 2022
A cross platform C99 library to get cpu features at runtime.

cpu_features A cross-platform C library to retrieve CPU features (such as available instructions) at runtime. Table of Contents Design Rationale Code

Google 2.2k Dec 22, 2022
Library that solves the exact cover problem using Dancing Links, also known as DLX.

The DLX Library The DLX library The DLX library solves instances of the exact cover problem, using Dancing Links (Knuth’s Algorithm X). Also included

Ben Lynn 44 Dec 18, 2022