is_valid_email

March 26, 2020

Name

is_valid_email — Determines whether emailaddr is a valid email address

Synopsis

#include "util.h"

| int **is_valid_email** ( | emailaddr, |   |
|   | mailbox_desc, |   |
|   | mailbox_desclen, |   |
|   | localpart, |   |
|   | lplen, |   |
|   | domain, |   |
|   | domainlen); |   |

const char * <var class="pdparam">emailaddr</var>;
char * <var class="pdparam">mailbox_desc</var>;
int <var class="pdparam">mailbox_desclen</var>;
char * <var class="pdparam">localpart</var>;
int <var class="pdparam">lplen</var>;
char * <var class="pdparam">domain</var>;
int <var class="pdparam">domainlen</var>;

Description

Determines whether emailaddr is a valid email address. If it is, then it will populate localpart and domain with the appropriate, parsed string values.

Parameters

emailaddr

The string that will be validated.

mailbox_desc

This value should always be passed NULL.

mailbox_desclen

The length of mailbox_desc, in bytes. This value should always be passed 0.

localpart

The localpart of the email address.

lplen

The length of the localpart, in bytes.

domain

The domain part of the email address.

domainlen

The length of domain, in bytes.

Return Values

This function returns the non-zero constant VALID_NOBRACKET if the emailaddr is valid, and 0 otherwise.

Threading

It is legal to call this function in any thread.

See Also

is_valid_IP and rfc2821_address_parse.