Files
spring-functions-catalog/supplier/spring-mail-supplier
dependabot[bot] aee27c2c0f Bump com.icegreen:greenmail
Bumps the development-dependencies group with 1 update in the /supplier/spring-mail-supplier directory: [com.icegreen:greenmail](https://github.com/greenmail-mail-test/greenmail).


Updates `com.icegreen:greenmail` from 2.1.1 to 2.1.2
- [Release notes](https://github.com/greenmail-mail-test/greenmail/releases)
- [Commits](https://github.com/greenmail-mail-test/greenmail/compare/release-2.1.1...release-2.1.2)

---
updated-dependencies:
- dependency-name: com.icegreen:greenmail
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: development-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-02 14:21:21 -05:00
..
2024-01-09 14:09:01 -05:00
2024-12-02 14:21:21 -05:00

= Mail Supplier

This module provides a File supplier that can be reused and composed in other applications.
The `Supplier` uses the mail IMAP and POP3 support from Spring Integration.
The `mailSupplier` bean is implemented as a `java.util.function.Supplier`.
This supplier gives you a reactive stream of emails from the provided url (imap or pop3).
The supplier has a signature of `Supplier<Flux<Message<?>>>`.
Users have to subscribe to this `Flux` and receive the data.

== Beans for injection

The `MailSupplierConfiguration` auto-configuration provides the following bean:

`mailSupplier`

You need to inject this as `Supplier<Flux<Message<?>>>`.

You can use `mailSupplier` as a qualifier when injecting.

Once injected, you can use the `get` method of the `Supplier` to invoke it and then subscribe to the returned `Flux`.

== Configuration Options

All configuration properties are prefixed with `mail.supplier`.

For more information on the various options available, please see link:src/main/java/org/springframework/cloud/fn/supplier/mail/MailSupplierProperties.java[MailSupplierProperties].

A `ComponentCustomizer<MailInboundChannelAdapterSpec<?, ?>>` (or `ComponentCustomizer<ImapIdleChannelAdapterSpec>` when `mail.supplier.idle-imap = true`) bean can be added in the target project to provide any custom options for the `MailInboundChannelAdapterSpec` (or `ImapIdleChannelAdapterSpec`, respectively) configuration used by the `mailSupplier`.

== Tests

See this link:src/test/java/org/springframework/cloud/fn/supplier/mail[test suite] for the various ways, this supplier is used.

== Other usage

See this https://github.com/spring-cloud/stream-applications/blob/master/applications/source/mail-source/README.adoc[README] where this supplier is used to create a Spring Cloud Stream application where it makes a Mail Source.