diff --git a/spring-integration-reference/src/mail.xml b/spring-integration-reference/src/mail.xml new file mode 100644 index 0000000000..31bc490dce --- /dev/null +++ b/spring-integration-reference/src/mail.xml @@ -0,0 +1,78 @@ + + + + Mail Support + +
+ Mail-Sending Channel Adapter + + Spring Integration provides support for outbound email with the + MailSendingMessageConsumer. It delegates to a configured instance of Spring's + JavaMailSender: + JavaMailSender mailSender = (JavaMailSender) context.getBean("mailSender"); + + MailSendingMessageConsumer mailSendingConsumer = new MailSendingMessageConsumer(mailSender); + MailSendingMessageConsumer various mapping strategies use Spring's + MailMessage abstraction. If the received Message's payload is already + a MailMessage instance, it will be sent directly. Therefore, it is generally recommended to precede this + consumer with a Transformer for non-trivial MailMessage construction requirements. However, a few simple + Message mapping strategies are supported out-of-the-box. For example, if the message payload is a byte array, + then that will be mapped to an attachment. If the payload is neither a MailMessage or byte array, then a + MailMessage will be created with text content corresponding to the value returned from the Spring Integration + Message payload's toString() method. For simple text-based emails, simply provide a + String-based Message payload. + + + The outbound MailMessage may also be configured with certain values from the + MessageHeaders. If available, values will be mapped to the outbound mail's + properties, such as the recipients (TO, CC, and BCC), the from/reply-to, and the subject. The header names are + defined by the following constants: + MailHeaders.SUBJECT + MailHeaders.TO + MailHeaders.CC + MailHeaders.BCC + MailHeaders.FROM + MailHeaders.REPLY_TO + +
+ +
+ Mail Namespace Support + + Spring Integration provides a namespace for mail-related configuration. To use it, configure the following schema + locations. +]]> + + + To configure an outbound Channel Adapter, provide the channel to receive from, and the MailSender: + ]]> + Alternatively, provide the host, username, and password: + ]]> + + Keep in mind, as with any outbound Channel Adapter, if the referenced channel is a PollableChannel, a + <poller> sub-element should be provided with either an interval-trigger or cron-trigger. + + + + When using the namespace support, a header-enricher Message Transformer is also available. + This simplifies the application of the headers mentioned above to any Message prior to sending to the + Mail-sending Channel Adapter. Also, note that a boolean value c + ]]> + +
+ +
\ No newline at end of file diff --git a/spring-integration-reference/src/namespaces.xml b/spring-integration-reference/src/namespaces.xml index 4a327f6d40..045d6ed0bf 100644 --- a/spring-integration-reference/src/namespaces.xml +++ b/spring-integration-reference/src/namespaces.xml @@ -73,13 +73,6 @@ ]]> - - - Cron support does require the Quartz JAR and its transitive dependencies. Also, keep in mind that pollers only - apply for PollableChannel implementations. On the other hand, subscribable channels - (PublishSubscribeChannel and DirectChannel) will send Messages to their subscribed targets directly. - -
The outbound <channel-adapter/> with a MessageTarget @@ -217,20 +210,9 @@ The most convenient way to configure Source and Target adapters is by using the namespace support. The following examples demonstrate the namespace-based configuration of several source, target, gateway, and handler adapters: - - - - - + - - ]]> diff --git a/spring-integration-reference/src/spring-integration-reference.xml b/spring-integration-reference/src/spring-integration-reference.xml index 69f98e155d..77f5c02e0d 100644 --- a/spring-integration-reference/src/spring-integration-reference.xml +++ b/spring-integration-reference/src/spring-integration-reference.xml @@ -53,6 +53,7 @@ +