Correct the e-mail validation

I have a textfield that accepts an email address.

I want to check for validation as soon as the focus of the text is lost.

Check the settings should be:

1. for example,[email protected]. Someemail here is the local part of the address, which typically identifies the user.

2. the local part cannot contain spaces (except if it is cited, which is rare, as in ' robert mitchell"").

3. the local party also cannot contain special characters various, as the following: () <> , ' @:; \\ [ ].  If anyone tries to create an e-mail address that looks like <(([[))> I want to reject outright.

4. the local part can and often it contains characters period, as in [email protected], but the periods must be preceded and followed by alphanumeric characters (that is, I can't use an email address for example[email protected]).

5. the domain may contain more than one period, as in [email protected], but it cannot begin or end with a period (as in [email protected]). [Finally, the guidelines permit but discourage a domain literal, as in robert@[].

These are the criteria I want to check in my validation code.

I used this area at the present time. A label of the E-mail: and a box to contain input (editfield)

I know there is a


But it has very limited validation. If someone can guide in each of these methods, I would be grateful.

//Add box next to field for containing input of email
       HorizontalFieldManager hfm2 = new HorizontalFieldManager();
       LabelField lbl2 = new LabelField(" Email:                  ");

       final EditField TextField3 = new EditField()

            protected void layout(int maxWidth, int maxHeight)
                super.layout(Math.min(maxWidth, 300), Math.min(maxHeight, 20));
            protected void paint(Graphics g)
                        g.drawRect(0,0, 50, 50);
                        int oldColor = g.getColor();
                        g.fillRect(0, 0, this.getPreferredWidth(), this.getPreferredHeight());
                        g.drawRect(100, 100, 50, 50);
       TextField3.setBorder(BorderFactory.createRoundedBorder(new XYEdges(6,6,6,6)));

Thank you.

Hi Tech

Try this function. may be useful for you.

public static boolean Emailval(String email)
        if (email == null || email.length() == 0 || email.indexOf("@") == -1 || email.indexOf(" ") != -1) {
            return false;
        int emailLenght = email.length();
        int atPosition = email.indexOf("@");

        String beforeAt = email.substring(0, atPosition);
        String afterAt = email.substring(atPosition + 1, emailLenght);

        if (beforeAt.length() == 0 || afterAt.length() == 0) {
            return false;
        if (email.charAt(atPosition - 1) == '.') {
            return false;
        if (email.charAt(atPosition + 1) == '.') {
            return false;
        if (afterAt.indexOf(".") == -1) {
            return false;
        char dotCh = 0;
        for (int i = 0; i < afterAt.length(); i++) {
            char ch = afterAt.charAt(i);
            if ((ch == 0x2e) && (ch == dotCh)) {
                return false;
            dotCh = ch;
        if (afterAt.indexOf("@") != -1) {
            return false;

        for (int i = 0; i < afterAt.length(); i++) {
            char ch = afterAt.charAt(i);
            if (!((ch >= 0x30 && ch <= 0x39) || (ch >= 0x41 && ch <= 0x5a) || (ch >= 0x61 && ch <= 0x7a)
                    || (ch == 0x2e) || (ch == 0x2d) || (ch == 0x5f))) {
                return false;
            if ((ch == 0x2e) && (ch == dotCh)) {
                return false;
            dotCh = ch;

        dotCh = 0;
        for (int i = 0; i < beforeAt.length(); i++) {
            char ch = beforeAt.charAt(i);
            if (!((ch >= 0x30 && ch <= 0x39) || (ch >= 0x41 && ch <= 0x5a) || (ch >= 0x61 && ch <= 0x7a)
                    || (ch == 0x2e) || (ch == 0x2d) || (ch == 0x5f))) {
                return false;
            if ((ch == 0x2e) && (ch == dotCh)) {
                return false;
            dotCh = ch;
        return true;

Thank you


Tags: BlackBerry Developers

Similar Questions

  • Hypothesis: Try to recover from a failed installation of XP Service Pack 3? - and - install correctly the e-mail client!

    Windows XP Home - I dropped a SP3 installation failure - and continued to my business.  Started to get the error message with IE features failed: "mail client is not properly installed.»  Advice seemed simple - "set access and default program ' but I couldn't find the options described by 'start' or 'control panel' research brought me to information which"set the default settings of the program"was a feature in SP1.
    So, here I am making assumptions.  1. How can I "correctly install customer e-mail (I use aol).»  2. I NEED TO revisit the attempt to install SP3?  Did the failure of the installation of the SP3 clear features in SP1?  Start a new installation of SP3?  Thanks for all the advice (but please enter slowly to more old-but-eager man who yet does not speak "geek" very well).  Thanks in advance. -Bill

    Is IE7 or IE8 installed?

    Which application should be the default email Client?

    To reaffirm the default value: start | Settings | Control Panel | Add/Remove programs. Set Program Access and Defaults. Click on the arrows pointing towards the bottom right of the configuration that is already checked. E-mail: Select Client Mail appropriate here (not "use my current... »).


    Assuming that you are running WinXP SP1 or SP2, see...

    HOW to get a computer that is running Windows XP SP1 (a) or SP2 fully patched
    [You can probably skip step 4]

    NB: Computers running under that WinXP SP2 will NOT be offered additional updates of security reviews, automatic updates will stop working, and Windows Update Web site will be unavailable after April 12, 2010, until that SP3 is installed.

    PS: Free unlimited installation and compatibility for WinXP SP3 support was available from April 14, 2008 to end of May 2009.  This support will cost you 59 US$ per incident now.

    ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • F &amp; G Committee &lt; ' F &amp; G Committee' &gt; is not a valid e-mail address because it is not the form user@host. You need to correct before sending the e-mail message.

    Out with the new v.31.1.0, the: 2 September 2014 version of Thunderbird, I can email is no longer a list of recipients, getting the error msg: F & G Committee < ' F & G Committee' > is not a valid e-mail address because it is not the form user@host. You need to correct before sending the e-mail message. In earlier versions, the addresses of individual e-mail in the list (F & G Committee in this case) are automatically placed in as the e-mail is sent. Is there a solution to this problem?

    Read this.

  • The e-mail on page validation irec external


    I want to validate the format of the e-mail entered the page address external iRecruitment. I tried extending the controller of the page and in the PFR, I wrote the code. But it does not work.

    My ExtendedCO has the following code-


    Import oracle.apps.irc.candidateSelfService.webui.RegisterCO;

    Import oracle.apps.fnd.framework.OAViewObject;

    Import oracle.apps.fnd.framework.webui.OAPageContext;

    Import oracle.apps.fnd.framework.webui.beans.OAWebBean;

    Import oracle.apps.fnd.framework.OAException;

    import oracle.apps.fnd .framework. OAAp plicationModule ;

    import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextIn putBean;

    Import oracle.apps.fnd.framework.server.OADBTransaction;

    Import oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean;

    import java.sql.CallableStateme nt;

    import java.sql.SQLException;

    import java.sql.Types;

    public class ExtendedRegiste rCO extends RegisterCO


    Public Sub processFormRequ EST (OAPageConte oapagecontext, OAWebBean oawebbean xt)


    String s = (String) oapagec ontext.getParam eter("Submit");

    OAMessageTextIn putBean = EmailCheck (OAMessageTextIn putBean) oawebbean.findChildRecursive ("Email");

    If (s.equals ("prese it") & & EmailCheck.getV alue (oapagecont ext)! = null)


    String Email = EmailCheck.getV alue (oapagecont ext) m:System.NET.SocketAddress.ToString ();

    String outParamValue;

    OADBTransaction txn = oapagecontext.g etApplicationMo dule (oawebbean) .getOADBTransac tion();

    CallableStateme cs = txn.createCallableStateme nt nt ("start: 1: = XXBR_CHECK_EMAI L(:2);") End; ",1) ;



    cs.registerOutP arameter (1, Types.VARCHAR);

    cs.setString (2, Email);

    CS. Execute();

    outParamValue = cs.getString (1) ;

    CS. Close();


    catch (SQLException sqle)


    launch OAException.wra pperException (s ELQ);


    If (outParamValue. ) is equal to ("FAILURE " ""))


    throw new OAException (Ema he + "is in the wrong format.) It should be in the format - [email protected] . Please correct. (' + outParamVa read OAException.ERR OR);



    super.processFo rmRequest (oapag digit, oawebbean);




    pl/sql code is-

    FUNCTION to CREATE or REPLACE xxbr_check_emai l (l_user_name in VARCHAR)


    l_dot_pos NUMBER;

    l_at_pos NUMBER;

    l_str_length NUMBER;


    l_dot_pos: = instr (l_user_na me )


    l_at_pos: = instr (l_user_na me )


    l_str_length: = length (l_user_n soul);

    IF ((l_dot_pos = 0) OR (l_at_pos = 0) OR (l_dot_pos = l_at_pos + 1) OR)

    (l_at_pos = 1) OR (l_at_pos = l_str_length) OR

    (l_dot_pos = l_str_length))



    END IF;

    IF instr (substr (l_ user_name ))


    ,'.') = 0



    END IF;


    END xxbr_check_email;


    have you checked this note: Validation of the email in the external candidates (Doc ID 1182533.1) registration process

    Thank you


  • Can I correct an error in the E-mail address if it's on an e-mail I want to convey. If this is not feasible should I use an email in the file sent as an attachment. towards a new w/o typing on?

    Email has been sent, but not received because an error in the address. A long email that I didn't retype wholw thing, so I just he returned by transfer. I thought it was because of bad weather in think Oaklahoma (tornadoes week before) has no verification of address once again, as I had in my contacts section & knew it was good. Finally, after two attempts, I realized that 3 was absent from the address - so not complete. It is saved in the sent file, but when I tried to correct the address on the original. I couldn't do it.  If this is not possible even to send thw wholw e-mail as an attachment to another which would have the correct address. I do not know how?

    Its very easy to do.  One way is to highlight the message and then go to the Message. Send as an attachment.  Or you just create a new message and drag the message to the folder above the new message then it will work.  You can also copy the message on the desktop, open it in Notepad and add this line:

    X sent: 1

    to the header of the message, and then save it then click on it to open it and it will open as a new message not sent with the same text as before.


  • "The constraints of validation" do not seem to import correctly.  Is this a bug?

    I boned my schema tables (file-> import-> data dictionary) and I noticed that "validation constraints" do not seem to import correctly.  While I peut see them perform a preview of the DDL, I can't understand how to modify them in the model.

    If you use the table in the example below, you will notice when you double-click on TEST_DEMO , which transports you to the properties of the Table, there is no place to view or change the constraints validation.  I guess that they are subject to constraints of Table-level but they are no where.

    Here is the example:















    For column-level constraints, double-click the column name in the table properties dialog box. Detailed properties appears. Are there constraints and default values.

    For the table level validation constraints, open the physical model (under relational node) and open the node of the table. Then you will see a Table Check Constraint level node. You can't go to the diagram.

  • Hi, the creative cloud continues to send my inactive email account validation e-mail. How can I change the e-mail address for verification

    Hi, the creative cloud continues to send my inactive email account validation e-mail. How can I change the e-mail address for verification

    email or


  • How can I save a document in pdf format pdf.p7m? I have digitally signed by Aruba I signed and the signature is valid, but not in pdf format, I contacted Aruba, I sent my card and regular and correct. Who can help me?

    How can I Save a document in PDF format PDF.p7m ?
    I digitally signed Aruba
    J’ai signed and the signature is valid, but not in pdf format pdf.p7m
    I contacted Aruba, I sent my card and regular and correct.
    Which peut help to me?

    Not possible with Adobe Acrobat.

    Open File Extension P7M

  • I can't connect to the CC with my Adobe ID; the necessary e-mail validation


    I can't connect with my adobe id to the CC but I a! And some time ago I was able to connect

    Now I need the apps on another PC and there comes the error "email address must be validated. Click here for a verification email.

    Well, I clicked on this link about 1000000 times and there's no e-mail validation, and I am not able to connect in CC (but in my Adobe account)

    Please contact Adobe customer service

  • Validation of an element containing the e-mail address


    Anyone developing the chain of validation for the e-mail address elements? I saw the validation of the URL, validation of IP addresses, same date and phone numbers...

    Thank you very much!

    Check out this site:

    There are many different regular expressions for validation.
    Hope that helps.

  • This error window appears every time I have send an email. The e-mail address is not a valid email address. I don't know where to delete this. I tried to look online to object, but also other research.

    The message could not be sent. The authentication setting are may not be wrong for your e-mail [SMTP] Server outgoing. To resolve this issue, go to help, search for "Troubleshoot Windows Mail" and read the section "I have problems sending e-mail". If you need help to determine the appropriate server settings, contact your e-mail service provider.

    The rejected e-mail address was ' * address email is removed from the privacy *'. "Are subject: movement of Winnebago, IT ', account: '', server: '', Protocol: SMTP, server response: ' 550 5.1.1 E4.13 box to the LETTERS NOT FOUND ', Port: 587, secure (SSL): no, Server error: 550, error number: 0x800CCC79

    Also, did you put a check mark on "my server requires authentication"?

    1. When you return to the dialog box accounts Internet, click on the Mail tab (if the dialog box going Internet is not open, click the Tools menu and then click accounts).
    2. Select your AOL IMAP account.
    3. Click on Properties.
    4. In the Properties dialog box, click the servers tab.
    5. In the outgoing mail server section, click the box my server requires authentication .
    6. Click apply.


  • BlackBerry smartphones to access the e-mail torch settings


    I changed my email password on my gmail account using the web browser on my desktop. But I have difficulties to access the e-mail on my Torch settings so that I can type the new password. I go to 'Set up' and then have the choice of the "Internet mail account" or "business account". I click on the first and get a page entitled "existing users". Then I type my user name and password. I guess that this refers to my blackberry user name and password. But when I type the info and press "contuinue" I get a message saying "the user name is not valid. A user name must be at least 4 characters." My user name is my gmail address, which includes 16 letters before

    What I am doing wrong?

    Thank you.

    Very well. Problem solved. Apparently when I first set up my Blackberry with my service provider, I did a combo of name of user and password on the Web site. Of course, I forgot all that I ever needed it again--until even two days ago.

    The trick is to contact your service provider and request the user name if you forgot. They can then send you a new password if you don't remember the original. With the correct username and the new password, you should be able to access e-mail settings, and then click the relevant e-mail account and change the password.

    It worked for me in any case. Good luck for the rest of you.

  • Lose or damage received the content of the e-mail, can see the fault once then apparent on refresh. worm 38.4 on 64-bit Windows8.1 / thank you

    Thunderbird worm 38.4/8.1 windows 64 bit
    Emails in the Inbox display content on the first reception. During subsequent attempts to display the message content can be completely empty or the contents of another adjacent email in the list. This seems to have started at the time that Norton detected and quarantined a couple of emails with identified the virus attached.
    After you run the full system antivirus scan I backed the content of the 789abc987.default of profile to backup taken yesterday. Now new emails coming to see the same problem, so that up to this older email display correctly.

    Unfortunately it doesn't seem wise to disable antivirus because in business, even if you wait for an attachment and you know the source, the technical capabilities of the source is not always known.

    I suggest to disable antivirus. Indeed, it would be a bad choice.
    The point is not to analyze the attachments so that they are still part of the e-mail message.

    Some form of holding directory which allow scanning prior to arrival in the mail app would be nice

    I don't know what you want to achieve by doing this. Yet once, any malware eventually joined an e-mail won't hurt as long as you do not deliberately open or run the attachment.

    Save an attachment to disk and then let it scan by anti-virus would be a good strategy.

  • Is it safe/simple to remove and re-add the account Mail in Internet accounts?

    I've dealt with this for months and months, and it drives me crazy. I have my email from Comcast (IMAP) account as my email account (accessible via Macbook Pro running El Capitan and my iPad), and whenever I turn the e-mail or the computer wake from mode standby, he asks my Mail password (Comcast). Fifty times a day. (I am also invited my password if I turn on the Notes, which is also attached to this same email account.) When I type the password, it works fine. The password also works fine if I connect to my email through webmail account, and Mail runs without problem on the iPad. HOWEVER, my password does NOT work if I try to enter through Internet/system preferences accounts. "I always get"Unable to connect to the account"/ unable to verify the account name or password" it.

    I tried constantly to get messages to remember the password in Mail preferences (by clicking on automatically detect and maintain settings settings advanced SMTP, remove information from keychain, etc, etc), but really, what I would try is to remove my account from Comcast Internet accounts and add new. Is it safe? I don't really want to remove the e-mail account; I just put it up again in the hope that some adjustment is messed up is corrected. But I don't want to lose my (value of years of) emails or folders and I don't want to lose my Notes either.

    Would I be able to reimport my mailboxes and notes (from my program Notes), if I delete the account and then set up again immediately in the accounts on the Internet?

    Yes, for IMAP accounts.

  • Emails sent via Thunderbird are not saved on the e-mail server.

    I have a critical problem with the backup of the emails I sent to Thunderbird.

    The application works very well, that everyone sent mail is correctly saved in the folder "sent" located in the e-mail account of TB.
    The problem is that messages are not saved on the mail server associated with (in this case,, so whenever I have to reinstall the software, I lose all my outgoing emails. If I access my email on account and email from there, it is regularly saved in the sent folder there.

    I would be grateful if someone could
    (i) say me if it is a known problem, and if there is a way to remedy through Thunberdird server or Composition settings.
    (ii) if there is a way around the problem by saving the file 'sent' located in the Thunderbird mail folder on my HARD drive. Is it possible, after the reinstallation of the application, to paste the file sent to the Mail folder? And I want to save the "Sent.msf" file as well?

    Thank you much for the help.

    The problem is that messages are not saved on the mail server associated with (in this case,,.

    With a POP account, this is the expected behavior. Only the Inbox folder is visible on the server, all the other files are the.

    To access the other folders on the server, for example your sent folder, you need to configure your account as an IMAP account.

    so whenever I have to reinstall the software, I lose all my outgoing emails.

    You should not need to reinstall the software in the first place. And even if you do you will not lose any position, unless you deliberately remove your Thunderbird profile.
    With pop, all mail is local to your computer, including the "sent" folder.

    If there is a way around the problem by saving the file 'sent' located in the Thunderbird mail folder on my HARD drive.

    In fact, you must back up the entire profile.
    _ _FAQs_:_Backing_Up_and_Restoring

    Is it possible, after the reinstallation of the application, to paste the file sent to the Mail folder?

    As said before, nothing is lost when reinstalling the application. If you want to move to a new computer by simply moving the profile.

    do I have to save the "Sent.msf" file as well?

    If you want to backup files individual mail, you don't need to save the *.msf files. They are just the index files and contain no mail. They are rebuild automatically when you start Thunderbird.
    In any case, to save the entire profile is the recommended method.

Maybe you are looking for

  • iPhoto themes

    MacBook Pro (13 inch, late 2011) Photos Application uses the 'themes' located in Mac HD > library > Application Support > iPhoto If this is not the case, can I delete the iPhoto folder? In addition, remove the iWorks and iLife files? I use Pages and

  • HP Security Bulletin notifications software cross-platform

    HP Multi - Platform Software Security Bulletin Notification I received today. What does that mean? I received the bullentin in my email.  What exaclty am I supposed to on the bullentin?  "- a bullentin examle >"  Critical security bulletins - 08/10/2

  • BlackBerry smartphones save e-mail addresses

    I'm sure there must be a way to get theBB to save the address of an e-mail I received, but I push any nbutton, there is no option, save this e-mail address I don't think it could form to import my contacts gmail? -I think not - but it would be conven

  • Cannot generate interesting traffic

    Why doesn't the following config generate no matter what interesting traffic when I ping I have a crypto debugging on and it doesn't seem to be any attempt to bring up the tunnel. I checked that it is hitting the correct

  • What I'm buying?

    I want to buy Photoshop, but now it seems that I bought something else... is - this identical to photoshop creative cloud?