Class MailProps

All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, Cloneable
Direct Known Subclasses:
EditorMailProps

public class MailProps extends PropCnr
Container holding mail settings.
Author:
Christopher Mindus
  • Field Details

    • COMPRESS

      public static final String COMPRESS
      Property name, saved mail compression type: 0=none, 1=gzip (default), 2=xz.
      See Also:
    • DEBUG

      public static final String DEBUG
      Property name, debug: "debug", default false.
      See Also:
    • QUEUED_MAIL_DIRECTORY

      public static final String QUEUED_MAIL_DIRECTORY
      Property name: queued mail directory: "directory".
      See Also:
    • DEFAULT_SENDER

      public static final String DEFAULT_SENDER
      Property name, default sender: "defaultSender".
      See Also:
    • DEFAULT_REPLYTO

      public static final String DEFAULT_REPLYTO
      Property name, default sender: "defaultReplyTo".
      See Also:
    • DEFAULT_CCS

      public static final String DEFAULT_CCS
      Property name, default sender: "defaultCCs".
      See Also:
    • DEFAULT_BCCS

      public static final String DEFAULT_BCCS
      Property name, default sender: "defaultBCCs".
      See Also:
    • MAIL_HOST

      public static final String MAIL_HOST
      Property name, mail host: "host".
      See Also:
    • PORT

      public static final String PORT
      Property name, mail port: "port" (1-65534, default 25).
      See Also:
    • BIND_ADDRESS

      public static final String BIND_ADDRESS
      Property name, mail bind port, default null for none.
      See Also:
    • SMTPS_PROTOCOL

      public static final String SMTPS_PROTOCOL
      Property name, mail host: "smtps".
      See Also:
    • USE_SSL

      public static final String USE_SSL
      Property name: enable SSL: "ssl".
      See Also:
    • USE_STARTTLS

      public static final String USE_STARTTLS
      Property name: use STARTTLS: "STARTTLS".
      See Also:
    • SERVER_IDENTITY_CHECK

      public static final String SERVER_IDENTITY_CHECK
      Server identity check: "serverIDCheck.

      RFC 2595 specifies addition checks that must be performed on the server's certificate to ensure that the server you connected to is the server you intended to connect to. This reduces the risk of "man in the middle" attacks.

      See Also:
    • TIMEOUT

      public static final String TIMEOUT
      Property name, timeout in milliseconds: "timeout".
      See Also:
    • USER_NAME

      public static final String USER_NAME
      The user name property string: "userName" (a StringProp).
      See Also:
    • PASSWORD

      public static final String PASSWORD
      The password property name: "password" (a PasswordProp).
      See Also:
  • Constructor Details

    • MailProps

      public MailProps()
      Creates the container properties without a name.
    • MailProps

      public MailProps(Atom atom)
      Creates the container properties with a name.
      Parameters:
      atom - The atom name.
  • Method Details

    • clone

      public MailProps clone()
      Clone must be overridden.
      Overrides:
      clone in class PropCnr
    • getMailQueueDirectory

      public File getMailQueueDirectory(File baseDir)
      Gets the send mail queue directory to use.
      Parameters:
      baseDir - The base directory where the server is (generally current directory).
      Returns:
      The mail directory, null for failure.
    • isDefaultSender

      public boolean isDefaultSender()
      Returns if this is the default mail sender.
      Returns:
      true if default, false otherwise.
    • getMailSender

      public MailSender getMailSender()
      Gets the current mail sender.
      Returns:
      The instance created, or null if not yet created.
    • getDefaultSender

      public InternetAddress getDefaultSender() throws AddressException
      Gets the Default Sender.
      Returns:
      The address, or null for none.
      Throws:
      AddressException - If the address is invalid.
    • getDefaultReplyTo

      public InternetAddress getDefaultReplyTo() throws AddressException
      Gets the Default Reply To.
      Returns:
      The address, or null for none.
      Throws:
      AddressException - If the address is invalid.
    • getDefaultCCs

      public InternetAddress[] getDefaultCCs() throws AddressException
      Gets the Default CCs.
      Returns:
      The address array "never zero in length", or null for none.
      Throws:
      AddressException - If the address is invalid.
    • getDefaultBCCs

      public InternetAddress[] getDefaultBCCs() throws AddressException
      Gets the Default BCCs.
      Returns:
      The address array "never zero in length", or null for none.
      Throws:
      AddressException - If the address is invalid.
    • createInstance

      public MailSender createInstance(ExecutorService executorService, File baseDir) throws IOException, NoSuchProviderException, AddressException
      Constructs the mail sender from the property if not already done.
      Parameters:
      executorService - The executor service.
      baseDir - The base directory where the server is (generally current directory).
      Returns:
      The instance created, or the existing one.
      Throws:
      IOException - If the mail queue directory does not exist.
      NoSuchProviderException - If the "smtp" or "smtps" providers do not exist!
      AddressException - If the default sender failed to parse.
    • verify

      public boolean verify(PropVerification verification)
      Verifies this property container. The check performed is the extension of classes and that no circular reference is present.
      Specified by:
      verify in interface IGProp<GProp<?>[]>
      Overrides:
      verify in class PropCnr
      Parameters:
      verification - The property verification class.
      Returns:
      true if verification should proceed, false if disposed of and verification should not take place.