com.jscape.inet.email

## Class EmailAddress

- java.lang.Object
- - com.jscape.inet.email.EmailAddress

- All Implemented Interfaces:
    java.io.Serializable

      public class EmailAddress
      extends java.lang.Object
      implements java.io.Serializable

  Implements basic functionality for parsing and validating the syntax of an email address.

  Example Usage:

       // create new instance
       EmailAdress email = new EmailAddress("user@myserver.com");

       // check for validity
       System.out.println("Valid: " + email.isValid());

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EmailAddress(java.lang.String email)` Constructs a new `EmailAddress`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getDomain()` Gets the domain portion of the email address.
    `java.lang.String` | `getEmail()` Return the full email address in the form user@domain.
    `java.lang.String` | `getName()` Gets the name portion of the email address.
    `java.lang.String` | `getUser()` Gets the user portion of the email address.
    `boolean` | `isValid()` Checks to see if this email address is syntactically valid.
    `java.lang.String` | `toString()` Get full email address.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### EmailAddress

          public EmailAddress(java.lang.String email)

      Constructs a new `EmailAddress`.
      Parameters:
        `email` - the email address Valid email addresses examples:

        jsmith@domain.com
        <jsmith@domain.com>
        John Smith <jsmith@domain.com>
        jsmith@domain.com (John Smith)

  - ### Method Detail

    - #### isValid

          public boolean isValid()

      Checks to see if this email address is syntactically valid.
      Returns:
        boolean `true` if email address is valid `false` otherwise

    - #### getEmail

          public java.lang.String getEmail()

      Return the full email address in the form user@domain.
      Returns:
        full email adddress

    - #### getUser

          public java.lang.String getUser()

      Gets the user portion of the email address.
      Returns:
        user portion of email address

    - #### getDomain

          public java.lang.String getDomain()

      Gets the domain portion of the email address.
      Returns:
        domain portion of email address

    - #### getName

          public java.lang.String getName()

      Gets the name portion of the email address.
      Returns:
        name portion of email address or `null` if not availalbe

    - #### toString

          public java.lang.String toString()

      Get full email address.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        full email address

Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved