org.appng.formtags.providers

## Class EmailProvider

- java.lang.Object
- - org.appng.formtags.providers.EmailProvider

- All Implemented Interfaces:
    FormProcessProvider

      public class EmailProvider
      extends Object
      implements FormProcessProvider

  A `FormProcessProvider` that send's and e-mail to some receivers. All the properties of the e-mail are being set via the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
  See the following property-keys for details:
  - `SENDER`
  - `SENDER_NAME`
  - `SUBJECT`
  - `RECEIVER_TO`
  - `RECEIVER_CC`
  - `RECEIVER_BCC`
  - `RECEIVER_DEBUG`
  - `REPLY_TO`
  - `EMAIL_CONTENT_TEXT`
  - `EMAIL_CONTENT_HTML`
  It is also possible to write a message to the given `Writer`, see `CONTENT` and `ERROR_MESSAGE`.
  Author:
    Matthias Müller

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ATTACHMENTS` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. If the value is `true`, the file attachments of the `Form` will be added to the e-mail.
    `static String` | `CONTENT` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. The value may contain the message that is written to the `Writer` passed to `onFormSuccess(Writer, Form, Map)`, in case the e-mail was successfully sent.
    `static String` | `EMAIL_CONTENT_HTML` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. Value can contain the HTML-content for the e-mail to send.
    `static String` | `EMAIL_CONTENT_TEXT` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. Value can contain the text-content for the e-mail to send.
    `static String` | `ERROR_MESSAGE` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. The value may contain the message that is written to the `Writer` passed to `onFormSuccess(Writer, Form, Map)`, in case an error occurs while sending the e-mail.
    `static String` | `RECEIVER_BCC` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. Value can contain a comma-separated list of e-mail addresses to send the mail with `Mail.RecipientType.BCC`
    `static String` | `RECEIVER_CC` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. Value can contain a comma-separated list of e-mail addresses to send the mail with `Mail.RecipientType.CC`
    `static String` | `RECEIVER_DEBUG` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. Value can contain a comma-separated list of e-mail addresses to which the e-mail will be send (instead of the real receivers)
    `static String` | `RECEIVER_TO` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. Value must contain a comma-separated list of e-mail addresses to send the mail with `Mail.RecipientType.TO`
    `static String` | `REPLY_TO` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. Value can contain a comma-separated list of e-mail addresses to reply-to
    `static String` | `SEND_DISABLED`
    `static String` | `SENDER` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. Value must contain the sender's e-mail address
    `static String` | `SENDER_NAME` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. Value can contain the sender's name
    `static String` | `SUBJECT` Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`. Value must contain the subject for the e-mail

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EmailProvider(MailTransport mailTransport)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isValidReceiver(String receiverEmails)`
    `void` | `onFormSuccess(Writer writer, Form form, Map<String,Object> properties)`

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

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

- - ### Field Detail

    - #### RECEIVER_TO

          public static final String RECEIVER_TO

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      Value must contain a comma-separated list of e-mail addresses to send the mail with `Mail.RecipientType.TO`
      See Also:
        Constant Field Values

    - #### RECEIVER_CC

          public static final String RECEIVER_CC

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      Value can contain a comma-separated list of e-mail addresses to send the mail with `Mail.RecipientType.CC`
      See Also:
        Constant Field Values

    - #### RECEIVER_BCC

          public static final String RECEIVER_BCC

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      Value can contain a comma-separated list of e-mail addresses to send the mail with `Mail.RecipientType.BCC`
      See Also:
        Constant Field Values

    - #### SENDER

          public static final String SENDER

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      Value must contain the sender's e-mail address
      See Also:
        Constant Field Values

    - #### SENDER_NAME

          public static final String SENDER_NAME

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      Value can contain the sender's name
      See Also:
        Constant Field Values

    - #### SEND_DISABLED

          public static final String SEND_DISABLED

      See Also:
        Constant Field Values

    - #### REPLY_TO

          public static final String REPLY_TO

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      Value can contain a comma-separated list of e-mail addresses to reply-to
      See Also:
        Constant Field Values

    - #### SUBJECT

          public static final String SUBJECT

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      Value must contain the subject for the e-mail
      See Also:
        Constant Field Values

    - #### RECEIVER_DEBUG

          public static final String RECEIVER_DEBUG

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      Value can contain a comma-separated list of e-mail addresses to which the e-mail will be send (instead of the real receivers)
      See Also:
        Constant Field Values

    - #### EMAIL_CONTENT_HTML

          public static final String EMAIL_CONTENT_HTML

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      Value can contain the HTML-content for the e-mail to send. One or both of text or HTML-content should be set.
      See Also:
        `EMAIL_CONTENT_TEXT`, Constant Field Values

    - #### EMAIL_CONTENT_TEXT

          public static final String EMAIL_CONTENT_TEXT

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      Value can contain the text-content for the e-mail to send. One or both of text or HTML-content should be set.
      See Also:
        `EMAIL_CONTENT_HTML`, Constant Field Values

    - #### ATTACHMENTS

          public static final String ATTACHMENTS

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      If the value is `true`, the file attachments of the `Form` will be added to the e-mail.
      See Also:
        Constant Field Values

    - #### CONTENT

          public static final String CONTENT

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      The value may contain the message that is written to the `Writer` passed to `onFormSuccess(Writer, Form, Map)`, in case the e-mail was successfully sent.
      See Also:
        Constant Field Values

    - #### ERROR_MESSAGE

          public static final String ERROR_MESSAGE

      Key for the `properties`-`Map` passed to `onFormSuccess(Writer, Form, Map)`.
      The value may contain the message that is written to the `Writer` passed to `onFormSuccess(Writer, Form, Map)`, in case an error occurs while sending the e-mail.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### EmailProvider

          public EmailProvider(MailTransport mailTransport)

  - ### Method Detail

    - #### onFormSuccess

          public void onFormSuccess(Writer writer,
                                    Form form,
                                    Map<String,Object> properties)

      Specified by:
        `onFormSuccess` in interface `FormProcessProvider`

    - #### isValidReceiver

          public boolean isValidReceiver(String receiverEmails)

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