|
|
|
|
|
- Email address to check
- Server validation: Requirements
- List of TLDs used during a string syntactic validation
EmailCheckAddress (Function) In french: EmailVérifieAdresse Checks the validity of an email address.
IF EmailCheckAddress("Moulain@test.fr", emailValidateSyntax) <> emailAddressValid THEN
Error("Veuillez vérifier l'adresse email fournie")
END
SWITCH EmailCheckAddress("azerty@orange.com")
CASE emailAddressValid
Info("Adresse valide")
CASE emailAddressIncorrectSyntax
Info("L'adresse est syntaxiquement fausse.")
CASE emailAddressRefused
Info("L'adresse a été refusée par le serveur de mails." + ...
"ErreurInfo permet d'obtenir la cause du refus.")
CASE emailAddressError
Info("Une erreur s'est produite pendant la vérification. " + ...
"ErreurInfo permet d'obtenir le détail de l'erreur.")
OTHER CASE
Info("Cas indéterminé")
END
Syntax
<Result> = EmailCheckAddress(<Address> [, <Validation level>])
<Result>: Integer constant Constant used to find out whether the address passed as parameter is valid: | | emailAddressError | An error occurred during the check. ErrorInfo returns the details of the error. | emailAddressIncorrectSyntax | The syntax of address is incorrect. | emailAddressRefused | The address was refused by the email server. ErrorInfo returns the reason for the refusal. | emailAddressValid | The address is valid. This address can be used by EmailSendMessage. |
Note: A waiting time may be required depending on the response time of the server being contacted. <Address>: Character string Email address to check. <Validation level>: Optional integer constant Desired type of validation. You have the ability to use one of the following constants: | | emailValidateByServer | Checks whether the SMTP email server of the domain to which the address belongs accepts the address in input. The syntax of the email address is automatically checked (emailValidateSyntax constant).
| emailValidateSyntax (Default value) | Checks the syntax of the email address. The TLD (Top Level Domain) is not checked. | emailValidateSyntaxStrict | Checks the syntax of the email address as well as the TLD (Top Level Domain) in relation to the list of existing TLDs (see Notes).
|
Remarks Email address to check - Although email addresses with the format "@[domain name].tld" have a valid syntax according to the RFC822 standard, they are not supported by EmailCheckAddress.
- If the <Validation level> corresponds to the emailValidateSyntax constant, the email address can contain an empty TLD ("doe@domain." for example).
- If the <Validation level> corresponds to the emailValidateByServer or emailValidateSyntaxStrict constant, the email address cannot contain any empty TLD ("vince@domain." for example). In this case, <Result> corresponds to emailAddressIncorrectSyntax.
Server validation: Requirements To use the validation by server (emailValidateByServer constant), the application must be able to contact: - a DNS server (by UDP on port 53),
- the email server of the domain to which the address to check belongs (by TCP, port 25).
Therefore, the firewalls may have to be configured specifically. Warning In some cases, an Email server may accept a non-existent address (for example, when the server is a relay server that doesn't have access to the list of accounts for the domain for which it collects mail). In this case, <Result> will correspond to the emailAddressValid constant even if the address does not exist. Furthermore, the time for retrieving the sever response can be quite long. Note The SMTP email server queried is identified by the MX (Mail Exchanger) record of the email address domain. List of TLDs used during a string syntactic validation When performing a strict syntactic check (emailValidateSyntaxStrict constant), a list of international and national TLDs is used. The list of TLDs was updated with the official IANA list (Internet Assigned Numbers Authority) dated May 2021. Note: Since this update, the available TLDs may have changed.
Related Examples:
|
Complete examples (WINDEV): WD Mail
[ + ] This application is an email client developed in WINDEV. It is based on the Email objects. This email client is used to retrieve and send emails by using the POP, IMAP and SMTP protocols. You have the ability to apply filters to the incoming emails. The application can also be used to manage several email accounts. The writing of an email is based on the HTML edit control.
|
Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|