Zimlet JavaScript API Reference - AjxEmailAddress

Class AjxEmailAddress


This class represents an email address and defines some related constants. The class does not attempt full compliance with RFC2822, so there are limitations for some of the edge cases.

Defined in: AjxEmailAddress.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
AjxEmailAddress(address, type, name, dispName, isGroup, canExpand)
Creates a new emal address, either by parsing an email string or from component parts.
Field Summary
Field Attributes Field Name and Description
<static>  
AjxEmailAddress.BCC
Defines the "bcc" type.
<static>  
AjxEmailAddress.CC
Defines the "cc" type.
<static>  
AjxEmailAddress.customInvalidEmailPats
Defines list of custom invalid RegEx patterns that are set in LDAP
<static>  
AjxEmailAddress.FROM
Defines the "from" type.
<static>  
AjxEmailAddress.TO
Defines the "to" type.
Method Summary
Method Attributes Method Name and Description
 
Clones this email address.
<static>  
AjxEmailAddress.copy(obj)
Copies the email address.
<static>  
AjxEmailAddress.dedup(addrs)
Returns the list of addresses with duplicates (based on email) removed.
 
Gets the address.
 
Gets the display name.
 
Gets the name.
 
Gets the type (to/from/cc/bcc).
 
Gets the type as a string.
<static>  
AjxEmailAddress.getValidAddresses(emailStr, type, strict)
Returns an AjxVector with valid email addresses
<static>  
AjxEmailAddress.isValid(str)
Checks if a string to see if it's a valid email string according to our mailbox pattern.
<static>  
AjxEmailAddress.parse(str)
Parses an email address string into its component parts.
<static>  
AjxEmailAddress.parseEmailString(emailStr, type, strict)
Parses a string with one or more addresses and parses it.
 
setAddress(addr)
Sets the address.
 
setType(type)
Sets the type.
<static>  
AjxEmailAddress.split(str)
Splits a string into (possible) email address strings based on delimiters.
 
toString(shortForm, forceUnescape)
Returns a string representation of this object.
Class Detail
AjxEmailAddress(address, type, name, dispName, isGroup, canExpand)
Creates a new emal address, either by parsing an email string or from component parts.
Author: Conrad Damon.
Parameters:
{string} address
an email string, or just the address portion
{constant} type
from, to, cc, bcc, or reply-to
{string} name
the personal name portion
{string} dispName
a brief display version of the name
{boolean} isGroup
if true, the address param is really a list of email addresses
canExpand
Field Detail
<static> AjxEmailAddress.BCC
Defines the "bcc" type.

<static> AjxEmailAddress.CC
Defines the "cc" type.

<static> AjxEmailAddress.customInvalidEmailPats
Defines list of custom invalid RegEx patterns that are set in LDAP

<static> AjxEmailAddress.FROM
Defines the "from" type.

<static> AjxEmailAddress.TO
Defines the "to" type.
Method Detail
{AjxEmailAddress} clone()
Clones this email address.
Returns:
{AjxEmailAddress} a clone of this email address

<static> {AjxEmailAddress} AjxEmailAddress.copy(obj)
Copies the email address.
Parameters:
{AjxEmailAddress} obj
the email to copy
Returns:
{AjxEmailAddress} the newly copied email address

<static> AjxEmailAddress.dedup(addrs)
Returns the list of addresses with duplicates (based on email) removed.
Parameters:
{array} addrs
list of AjxEmailAddress

{string} getAddress()
Gets the address.
Returns:
{string} the address

{string} getDispName()
Gets the display name.
Returns:
{string} the name

{string} getName()
Gets the name.
Returns:
{string} the name

{constant} getType()
Gets the type (to/from/cc/bcc).
Returns:
{constant} the type

{string} getTypeAsString()
Gets the type as a string.
Returns:
{string} the type (to/from/cc/bcc)

<static> {AjxVector} AjxEmailAddress.getValidAddresses(emailStr, type, strict)
Returns an AjxVector with valid email addresses
Parameters:
{string} emailStr
an email string with one or more addresses
{constant} type
address type of the string
{boolean} strict
if true, do strict checking
Returns:
{AjxVector} valid addresses

<static> {boolean} AjxEmailAddress.isValid(str)
Checks if a string to see if it's a valid email string according to our mailbox pattern.
Parameters:
{string} str
an email string
Returns:
{boolean} true if the string is valid

<static> {AjxEmailAddress} AjxEmailAddress.parse(str)
Parses an email address string into its component parts. The parsing is adapted from the perl module Email::Address. Check that out if you want to know how the gory regexes that do the parsing were built. They are based on RFC2822, but don't represent a full implementation. We don't really need or want that, since we don't want to be overly restrictive or bloated. It was easier to just use the resulting regexes from the Perl module, rather than go through all the rigmarole of building them up from atoms.

If the address parses successfully, the current object's properties will be set.

Parameters:
{string} str
the string to parse
Returns:
{AjxEmailAddress} the email address or null

<static> {hash} AjxEmailAddress.parseEmailString(emailStr, type, strict)
Parses a string with one or more addresses and parses it. An object with lists of good addresses, bad addresses, and all addresses is returned. Strict RFC822 validation (at least as far as it goes in the regexes we have) is optional. If it's off, we'll retry a failed address after quoting the personal part.
Parameters:
{string} emailStr
an email string with one or more addresses
{constant} type
address type of the string
{boolean} strict
if true, do strict checking
Returns:
{hash} the good/bad/all addresses

setAddress(addr)
Sets the address.
Parameters:
{string} addr
the address

setType(type)
Sets the type.
Parameters:
{constant} type
the type (to/from/cc/bcc)

<static> {array} AjxEmailAddress.split(str)
Splits a string into (possible) email address strings based on delimiters. Tries to be flexible about what it will accept. The following delimiters are recognized, under the following conditions:
  • return -- always
  • semicolon -- must not be inside quoted or comment text
  • comma -- must not be inside quoted or comment text, and must follow an address (which may be in angle brackets)
  • space -- can only separate plain addresses (no quoted or comment text)
The requirement that a comma follow an address allows us to be lenient when a mailer doesn't quote the friendly part, so that a string such as the one below is split correctly: Smith, John <jsmith@aol.com>
Parameters:
{string} str
the string to be split
Returns:
{array} the list of {String} addresses

{string} toString(shortForm, forceUnescape)
Returns a string representation of this object.
Parameters:
{boolean} shortForm
if true, return a brief version (name if available, otherwise email)
{boolean} forceUnescape
if true, name will not be in quotes and any quotes inside the name will be unescaped (e.g. "John \"JD\" Doe" becomes John "JD" Doe
Returns:
{string} a string representation of this object

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:30 GMT-0400 (EDT)