i2p.susi.webmail

## Class Mail

- java.lang.Object
- - i2p.susi.webmail.Mail

- Direct Known Subclasses:
    Draft

      class Mail
      extends Object

  Data structure representing a single email message for folder display and sorting.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) String[]` | `cc` May be null.
    `String` | `contentType`
    `Date` | `date`
    `String` | `dateOnly`
    `String` | `dateString`
    `String` | `error`
    `String` | `formattedDate`
    `(package private) static byte[]` | `HEADER_MATCH` Also used by MailPart See MailPart for why we don't do \r\n\r\n
    `String` | `localFormattedDate`
    `boolean` | `markForDeletion`
    `String` | `messageID`
    `String` | `quotedDate`
    `String` | `reply`
    `String` | `sender`
    `String` | `shortSender`
    `String` | `shortSubject`
    `String` | `subject`
    `(package private) String[]` | `to` May be null.
    `String` | `uidl`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Mail(String uidl)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `appendRecipients(PrintWriter out, String[] recipients, String prefix)` Adds all items from the array to the builder, separated by commas This is for display of a forwarded email.
    `static void` | `appendRecipients(StringBuilder buf, ArrayList<String> recipients, String prefix)` Adds all items from the list to the builder, separated by tabs.
    `static String` | `getAddress(String address)` Returns the first email address portion, enclosed by <>
    `String` | `getAttachmentType()`
    `Buffer` | `getBody()` This contains the header also.
    `Buffer` | `getHeader()` This may or may not contain the body also.
    `MailPart` | `getPart()`
    `static boolean` | `getRecipientsFromList(ArrayList<String> recipients, String[] ccs, boolean ok)` A little misnamed.
    `static boolean` | `getRecipientsFromList(ArrayList<String> recipients, String text, boolean ok)` A little misnamed.
    `long` | `getSize()`
    `boolean` | `hasAttachment()`
    `boolean` | `hasBody()`
    `boolean` | `hasHeader()`
    `boolean` | `hasPart()`
    `boolean` | `isNew()`
    `boolean` | `isSpam()`
    `void` | `setBody(Buffer rb)`
    `void` | `setHeader(Buffer rb)`
    `void` | `setNew(boolean isNew)`
    `void` | `setSize(long size)`
    `static boolean` | `validateAddress(String address)`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### cc

          String[] cc

      May be null. Non-empty if non-null. Not HTML escaped.

    - #### contentType

          public String contentType

    - #### date

          public Date date

    - #### dateOnly

          public String dateOnly

    - #### dateString

          public String dateString

    - #### error

          public String error

    - #### formattedDate

          public String formattedDate

    - #### HEADER_MATCH

          static final byte[] HEADER_MATCH

      Also used by MailPart See MailPart for why we don't do \r\n\r\n

    - #### localFormattedDate

          public String localFormattedDate

    - #### markForDeletion

          public boolean markForDeletion

    - #### messageID

          public String messageID

    - #### quotedDate

          public String quotedDate

    - #### reply

          public String reply

    - #### sender

          public String sender

    - #### shortSender

          public String shortSender

    - #### shortSubject

          public String shortSubject

    - #### subject

          public String subject

    - #### to

          String[] to

      May be null. Non-empty if non-null. Not HTML escaped.

    - #### uidl

          public final String uidl

  - ### Constructor Detail

    - #### Mail

          public Mail(String uidl)

  - ### Method Detail

    - #### appendRecipients

          public static void appendRecipients(PrintWriter out,
                                              String[] recipients,
                                              String prefix)

      Adds all items from the array to the builder, separated by commas This is for display of a forwarded email.
      Parameters:
        `prefix` - prepended to the addresses, includes trailing ": "

    - #### appendRecipients

          public static void appendRecipients(StringBuilder buf,
                                              ArrayList<String> recipients,
                                              String prefix)

      Adds all items from the list to the builder, separated by tabs. This is for SMTP/POP.
      Parameters:
        `buf` - out param
        `prefix` - prepended to the addresses

    - #### getAddress

          public static String getAddress(String address)

      Returns the first email address portion, enclosed by <>
      Parameters:
        `address` -

    - #### getAttachmentType

          public String getAttachmentType()

    - #### getBody

          public Buffer getBody()

      This contains the header also.
      Returns:
        may be null

    - #### getHeader

          public Buffer getHeader()

      This may or may not contain the body also.
      Returns:
        if null, nothing has been loaded yet for this UIDL

    - #### getPart

          public MailPart getPart()

    - #### getRecipientsFromList

          public static boolean getRecipientsFromList(ArrayList<String> recipients,
                                                      String[] ccs,
                                                      boolean ok)

      A little misnamed. Adds all addresses from the elements in text to the recipients list.
      Parameters:
        `recipients` - out param
        `ok` - will be returned
      Returns:
        true if ALL e-mail addresses are valid AND the in parameter was true

    - #### getRecipientsFromList

          public static boolean getRecipientsFromList(ArrayList<String> recipients,
                                                      String text,
                                                      boolean ok)

      A little misnamed. Adds all addresses from the comma-separated line in text to the recipients list.
      Parameters:
        `text` - comma-separated
        `recipients` - out param
        `ok` - will be returned
      Returns:
        true if ALL e-mail addresses are valid AND the in parameter was true

    - #### getSize

          public long getSize()

      Returns:
        0 if unknown

    - #### hasAttachment

          public boolean hasAttachment()

    - #### hasBody

          public boolean hasBody()

    - #### hasHeader

          public boolean hasHeader()

      Returns:
        if false, nothing has been loaded yet for this UIDL

    - #### hasPart

          public boolean hasPart()

    - #### isNew

          public boolean isNew()

    - #### isSpam

          public boolean isSpam()

    - #### setBody

          public void setBody(Buffer rb)

    - #### setHeader

          public void setHeader(Buffer rb)

    - #### setNew

          public void setNew(boolean isNew)

    - #### setSize

          public void setSize(long size)

    - #### validateAddress

          public static boolean validateAddress(String address)

      Parameters:
        `address` - E-mail address to be validated
      Returns:
        Is the e-mail address valid?