Uniface User Forum

 View Only
  • 1.  Validate format of address email

    Posted 15 days ago
    Hi,
    Is there a Uniface function that checks if a string is a valide email address ?
    If not, is there a simple to do it with the match pattern ?  We use it to successfully to check if a field is numeric with :

    If (MyString != '(-)#*(.)#*') Message/info "Non numeric value",

    but I can't find how to ckeck if MyString contains only authorized character with @ in middle and .fr or .com  or any other else at the end.
    Thanks for adcance.
    Laurent.



    ------------------------------
    Laurent Merot
    Rocket Forum Shared Account
    ------------------------------


  • 2.  RE: Validate format of address email

    Posted 15 days ago
    Hi Laurent,
    AFAIK a basic eMail address pattern checking requires:
    - 1 to N characters
    - a mandatory "@"
    - 1 to N characters
    - a mandatory "."
    - 1 to N characters

    ​Probably an acceptable $syntax is:
    ~@~@*%@~@~@*%.~@~@*
    but I am sure someone else will help you with a better solution!
    :-) :-) :-)

    Regards,
    Gianni



    ------------------------------
    Gianni Sandigliano
    IT
    ------------------------------



  • 3.  RE: Validate format of address email

    Posted 15 days ago
    Edited by Laurent Merot 15 days ago
    Hi Gianni,
    It works very well ! 
    And with (-) before or after the @ in this check, we can also authorize draws in the syntax.
    Tks a lot, have a good day.
    ​​

    ------------------------------
    Laurent Merot
    Rocket Forum Shared Account
    ------------------------------



  • 4.  RE: Validate format of address email

    Posted 15 days ago

    Hi Laurent,

    Happy to have help you!

    Anyhow, please consider this further option about eMail address checking:

    It's best practice to test deliverability to any email address. This will establish two important things:

    1. Whether the email box currently exists
    2. That the user has access to that email box (and is the legitimate user or owner)

    If you build email activation processes into your business process, you don't need to worry about other complicated regular expressions that could  be found on the internet.

    ​Best Regards,
    Gianni



    ------------------------------
    Gianni Sandigliano
    IT
    ------------------------------



  • 5.  RE: Validate format of address email

    PARTNER
    Posted 15 days ago
    Whilst that is good practice for 'user' interactions, it presumes the person adding the email address is the end client and/or system user. If your staff are adding contacts to a system from an incoming email or telephone call, then the 'two factor' thing above is not likely to be well received by the end client. 
    You would, however, still want to check the base validity of the email address to help prevent typos. 

    Regards, 
    Iain

    ------------------------------
    Iain Sharp
    Head of Technical Services
    Pci Systems Ltd
    Sheffield GB
    ------------------------------



  • 6.  RE: Validate format of address email

    Posted 14 days ago
    Hi laurent,

    The most correct would be transform in a list before "@" and after "@", there are cases where the e-mail has a dot before de "@".
    firstname.lastname@asdfasd.asdfad

    v_email  = $replace("firstname.lastname@asdfasd.asdfad", 1, "@", "+;", -1)

    Regards,

    Juliano





    ------------------------------
    Juliano Garcia
    Suport Analyst
    Coamo -Coop. Agropecuaria Mouraoense
    Campo Mourão BR
    ------------------------------



  • 7.  RE: Validate format of address email

    Posted 13 days ago
    Hi Juliano,

    I've modified the test to authorize dot (.) and draw (-) before and after the @, and draw (-) after the @ :
    If (MyMail != '~@~@*(-)~@*(.)~@*(-)~@*%@~@~@*(-)~@*%.~@~@*)
     RES= "Not OK"
    Else
     RES="OK"
    EndIf​
    I've then just to control the length of the address. It won't be the guarantee of an exiting and valid e-mail address but my users are not end-user and I can't test the deliverability to any email address as suggests Gianni.

    Regards,
    Laurent​

    ------------------------------
    Laurent Merot
    Rocket Forum Shared Account
    ------------------------------