Class Addresses

java.lang.Object
java.util.AbstractMap<javax.mail.Message.RecipientType,List<javax.mail.internet.InternetAddress>>
java.util.HashMap<javax.mail.Message.RecipientType,List<javax.mail.internet.InternetAddress>>
org.bgerp.util.mail.Addresses
All Implemented Interfaces:
Serializable, Cloneable, Map<javax.mail.Message.RecipientType,List<javax.mail.internet.InternetAddress>>

public class Addresses extends HashMap<javax.mail.Message.RecipientType,List<javax.mail.internet.InternetAddress>>
EMail addresses recipients parser and serializer. Supported recipient types: TO, CC, BCC.
See Also:
  • Constructor Details

    • Addresses

      public Addresses()
    • Addresses

      public Addresses(String addresses)
  • Method Details

    • parse

      public static Addresses parse(String lang, String addresses) throws BGMessageException
      Parses email addresses. Actual format:
      to1, to2..,CC: cc1, cc2..,BCC: bcc1, bcc2..
      Old one:
      to1, to2..,CC: cc1, cc2..,BCC: bcc1, bcc2..
      Parameters:
      lang - language for translating message exceptions.
      addresses - email addresses string.
      Returns:
      a created instance.
      Throws:
      BGMessageException - incorrect email was given in addresses and silent is false.
    • parseSafe

      public static Addresses parseSafe(String addresses)
      Parses email addresses. Actual format:
      to1, to2..,CC: cc1, cc2..,BCC: bcc1, bcc2..
      Old one:
      to1, to2..,CC: cc1, cc2..,BCC: bcc1, bcc2..
      Parameters:
      addresses - email addresses string.
      Returns:
      a created instance.
    • addTo

      public Addresses addTo(String value)
      Appends an email as recipient TO address.
      Parameters:
      value - the email.
      Returns:
    • exclude

      public Addresses exclude(String value)
      Deletes an email from all the types of existing addresses.
      Parameters:
      value - the email.
      Returns:
    • serializeTo

      public String serializeTo()
    • serializeCc

      public String serializeCc()
    • serializeBcc

      public String serializeBcc()
    • serialize

      public String serialize()
      Serializes emails to a string like:
      to1, to2..,CC: cc1, cc2..,BCC: bcc1, bcc2..
      Returns:
      the string.
    • recipients

      public LinkedHashMap<javax.mail.Message.RecipientType,javax.mail.internet.InternetAddress[]> recipients()
      Returns ordered recipients map. First TO, than CC and BCC.
      Returns: