org.appng.mail.impl

## Class DefaultTransport

- java.lang.Object
- - org.appng.mail.impl.DefaultTransport

- All Implemented Interfaces:
    MailTransport

      public class DefaultTransport
      extends Object
      implements MailTransport

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `ALTERNATIVE`
    `protected static String` | `CONTENT_TRANSFER_ENCODING`
    `protected boolean` | `debug`
    `protected boolean` | `disableSend`
    `static String` | `HOST`
    `protected static String` | `MIXED`
    `protected Properties` | `p`
    `static String` | `PORT`
    `protected javax.mail.Session` | `session`
    `protected static String` | `TEXT_HTML`
    `protected static String` | `UTF_8`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `DefaultTransport()`
    `` | `DefaultTransport(Properties props)`
    `` | `DefaultTransport(Properties props, String user, String password)`
    `` | `DefaultTransport(javax.mail.Session session)`
    `` | `DefaultTransport(String host, int port)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected javax.mail.Message` | `buildMessage(Mail mail)`
    `protected javax.mail.Message` | `buildMessage(javax.mail.Message mimeMessage, Mail mail)`
    `Mail` | `createMail()` Creates and returns a new `Mail`.
    `void` | `disableSend()`
    `String` | `getMailAsString(Mail mail)` Returns a string-representation if the given `Mail`. Attention: The `Mail` may contain sensitive informations like passwords!
    `boolean` | `isDebug()`
    `boolean` | `isDisableSend()` Checks whether this `MailTransport` is disabled.
    `void` | `send(Mail mail)` Send the given `Mail`.
    `protected void` | `send(Mail mail, Collection<String> invalidAdresses)`
    `void` | `setDebug(boolean debug)`
    `void` | `setDisableSend(boolean disableSend)` Enable/disable sending for this `MailTransport`.
    `javax.mail.Address` | `toAddress(Address address)`

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

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

- - ### Field Detail

    - #### TEXT_HTML

          protected static final String TEXT_HTML

      See Also:
        Constant Field Values

    - #### CONTENT_TRANSFER_ENCODING

          protected static final String CONTENT_TRANSFER_ENCODING

      See Also:
        Constant Field Values

    - #### UTF_8

          protected static final String UTF_8

      See Also:
        Constant Field Values

    - #### MIXED

          protected static final String MIXED

      See Also:
        Constant Field Values

    - #### ALTERNATIVE

          protected static final String ALTERNATIVE

      See Also:
        Constant Field Values

    - #### HOST

          public static final String HOST

      See Also:
        Constant Field Values

    - #### PORT

          public static final String PORT

      See Also:
        Constant Field Values

    - #### session

          protected javax.mail.Session session

    - #### p

          protected Properties p

    - #### disableSend

          protected boolean disableSend

    - #### debug

          protected boolean debug

  - ### Constructor Detail

    - #### DefaultTransport

          protected DefaultTransport()

    - #### DefaultTransport

          public DefaultTransport(javax.mail.Session session)

    - #### DefaultTransport

          public DefaultTransport(String host,
                                  int port)

    - #### DefaultTransport

          public DefaultTransport(Properties props)

    - #### DefaultTransport

          public DefaultTransport(Properties props,
                                  String user,
                                  String password)

  - ### Method Detail

    - #### createMail

          public Mail createMail()

      Description copied from interface: `MailTransport`
      Creates and returns a new `Mail`.
      Specified by:
        `createMail` in interface `MailTransport`
      Returns:
        the new `Mail`

    - #### send

          public void send(Mail mail)
                    throws MailException

      Description copied from interface: `MailTransport`
      Send the given `Mail`.
      Specified by:
        `send` in interface `MailTransport`
      Parameters:
        `mail` - the `Mail` to send
      Throws:
        `MailException` - if an error occurs while sending the `Mail`

    - #### getMailAsString

          public String getMailAsString(Mail mail)

      Description copied from interface: `MailTransport`
      Returns a string-representation if the given `Mail`.
      Attention: The `Mail` may contain sensitive informations like passwords!
      Specified by:
        `getMailAsString` in interface `MailTransport`
      Parameters:
        `mail` - the `Mail` to get the string-representation for
      Returns:
        a `String` representation the `Mail`

    - #### send

          protected void send(Mail mail,
                              Collection<String> invalidAdresses)
                       throws MailException

      Throws:
        `MailException`

    - #### buildMessage

          protected javax.mail.Message buildMessage(Mail mail)
                                             throws MailException

      Throws:
        `MailException`

    - #### buildMessage

          protected javax.mail.Message buildMessage(javax.mail.Message mimeMessage,
                                                    Mail mail)
                                             throws MailException

      Throws:
        `MailException`

    - #### disableSend

          public void disableSend()

    - #### isDisableSend

          public boolean isDisableSend()

      Description copied from interface: `MailTransport`
      Checks whether this `MailTransport` is disabled.
      Specified by:
        `isDisableSend` in interface `MailTransport`
      Returns:
        `true` if this `MailTransport` is disabled, `false` otherwise.

    - #### setDisableSend

          public void setDisableSend(boolean disableSend)

      Description copied from interface: `MailTransport`
      Enable/disable sending for this `MailTransport`. If set to `true`, `Mail`s will be logged instead of being send.
      Specified by:
        `setDisableSend` in interface `MailTransport`

    - #### isDebug

          public boolean isDebug()

    - #### setDebug

          public void setDebug(boolean debug)

    - #### toAddress

          public javax.mail.Address toAddress(Address address)
                                       throws UnsupportedEncodingException

      Throws:
        `UnsupportedEncodingException`

Copyright © 2011–2023 aiticon GmbH. All rights reserved.