Mstdlib-1.24.0
|
Validation of strings against various standards (email address, domain name, etc.). More...
Enumerations | |
enum | M_verify_email_listdelim_t { M_VERIFY_EMAIL_LISTDELIM_AUTO = 0 , M_VERIFY_EMAIL_LISTDELIM_SEMICOLON , M_VERIFY_EMAIL_LISTDELIM_COMMA } |
Functions | |
M_bool | M_verify_email_address (const char *addr) |
M_bool | M_verify_domain (const char *dname) |
M_bool | M_verify_email_address_list (const char *addr_list, M_verify_email_listdelim_t delim_type) |
Validation of strings against various standards (email address, domain name, etc.).
M_bool M_verify_email_address | ( | const char * | addr | ) |
Verify that the given single email address is valid.
An email address is composed of the following parts:
display_name<local_part@domain>
The display name may contain double-quotes. Within double-quotes, the full range of symbols may be used (dot, comma, semicolon, at, escaped double-quote, etc.). The space and tab characters are allowed in the display name, even outside of quotes.
If the display name is not provided, the angle brackets around the rest of the email address are optional.
This email address validator differs from the RFC standards for email in the following ways:
'*+-=^_{}.~
Example of valid address:
"Public, John Q. (Support)" <jq..public+support@generic-server.com>
[in] | addr | email address to verify |
M_bool M_verify_domain | ( | const char * | dname | ) |
Verify that the given domain name is valid.
Valid domain names are composed of letters, digits, and hyphens ('-'), separated into sections by dots ('.'). Each section is limited to 63 chars, and may not begin or end with a hyphen. The entire domain name is limited to 253 characters - note that a 253 character domain name takes 255 bytes to store with the length-prefixed encoding used by DNS.
[in] | dname | domain name to verify |
M_bool M_verify_email_address_list | ( | const char * | addr_list, |
M_verify_email_listdelim_t | delim_type | ||
) |
Verify that the given list of email addresses is valid.
The list may be delimited by either commas (',') or semicolons (';'), but not both. This function limits the number of addresses in the list to 100 - this isn't a true standard, but it's the limit used virutally everywhere in practice.
The list parser is tolerant of whitespace - individual addresses are trimmed before they're passed to the email address validator.
The individual addresses in the list may include display names (a.k.a friendly names).
[in] | addr_list | list of email addresses to verify |
[in] | delim_type | Type of delimiter to expect. Can be auto detected. |