gh0stwizard / libeav Goto Github PK
View Code? Open in Web Editor NEWThe Email Address Validation Library
License: BSD 2-Clause "Simplified" License
The Email Address Validation Library
License: BSD 2-Clause "Simplified" License
Following functions will both output 1, i.e valid emails
int try_rfc_6531() {
eav_t eav;
eav_init(&eav);
eav.tld_check = false;
eav.rfc = EAV_RFC_6531;
eav_setup(&eav);
const char eml[] = "abc@def_ghi.us";
int len = sizeof(eml) - 1;
int ret = eav_is_email(&eav, eml, len);
eav_free(&eav);
return ret;
}
int try_rfc_5321() {
eav_t eav;
eav_init(&eav);
eav.tld_check = false;
eav.rfc = EAV_RFC_5321;
eav_setup(&eav);
const char eml[] = "abc@def_ghi.us";
int len = sizeof(eml) - 1;
int ret = eav_is_email(&eav, eml, len);
eav_free(&eav);
return ret;
}
int main() {
printf("rfc-6531 for underscore=%d\nrfc-5321 for underscore=%d",
try_rfc_6531(), try_rfc_5321());
return 0;
}
but as per RFC 5321, an email address's domain part cannot contain _
and this RFC particularly mentions this restriction:
To promote interoperability and consistent with long-standing
guidance about conservative use of the DNS in naming and applications
(e.g., see Section 2.3.1 of the base DNS document, RFC 1035 [2]),
characters outside the set of alphabetic characters, digits, and
hyphen MUST NOT appear in domain name labels for SMTP clients or
servers. In particular, the underscore character is not permitted.
SMTP servers that receive a command in which invalid character codes
have been employed, and for which there are no other reasons for
rejection, MUST reject that command with a 501 response (this rule,
like others, could be overridden by appropriate SMTP extensions).
So I think it may be an issue in current implemention.
By the way, thank you for your great library, it helped a lot :P
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.