Hi: I have a job which run a codeunit for sending emails. The problem is that sometimes users write wrong address and the job fails.
Does anyone knows about a code to check the address?
The mailadressformat is wrong or the address not exist :?:
If the format is wrong, u must only check if there is a "@" and before the @ are letters (the local part) and after the @ are letters (the domain part). Both parts are split by the @.
The local part could only have letters or numbers and some chars like: A-Za-z0-9.!#$%&'*+-/=?^_`{|}~ (so here you can check the local part).
For the second part, the domain part exist also rules (see Domain Name System [DNS]). so check if after the @ is an "." (dot) and after the dot min. 2-4 letters. Then it could be an correct mailaddress (format)
EDIT
if you need mor infos:
The whole definition of a EMail Addressformat you can read in "RFC 2822, 2606 2821" and some others.
IF "E-Mail" = xRec."E-Mail" THEN EXIT;
"E-Mail" := LOWERCASE("E-Mail");
IF ("E-Mail" <> '') AND (STRPOS("E-Mail",'@') = 0) THEN
ERROR('@ must exist in E-Mail.');
IF ("E-Mail" <> '') AND (STRPOS("E-Mail",'.') = 0) THEN
ERROR('. must exist in E-Mail.');
Comments
"Show All..."
"Oh..."
If the format is wrong, u must only check if there is a "@" and before the @ are letters (the local part) and after the @ are letters (the domain part). Both parts are split by the @.
The local part could only have letters or numbers and some chars like: A-Za-z0-9.!#$%&'*+-/=?^_`{|}~ (so here you can check the local part).
For the second part, the domain part exist also rules (see Domain Name System [DNS]). so check if after the @ is an "." (dot) and after the dot min. 2-4 letters. Then it could be an correct mailaddress (format)
EDIT
if you need mor infos:
The whole definition of a EMail Addressformat you can read in "RFC 2822, 2606 2821" and some others.
Regards
E-Mail - OnValidate()
http://www.BiloBeauty.com
http://www.autismspeaks.org