Class MailMessageSender

All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, WebServiceMessageSender

public class MailMessageSender extends AbstractWebServiceMessageSender<MailDestinationDescriptor> implements org.springframework.beans.factory.InitializingBean
WebServiceMessageSender implementation that uses Mail MimeMessages. Requires a transport and store URI to be set.

Calling WebServiceConnection.receive(WebServiceMessageFactory) on connections created by this message sender will result in a blocking call, for the amount of milliseconds specified by the receiveSleepTime property. This will give the server time to formulate a response message. By default, this property is set to 1 minute. For a proper request-response conversation to work, this property value must not be smaller the pollingInterval property of the server-side message receiver polling strategy.

This message sender supports URI's of the following format:

mailto:<to>[?param-name=param-value][&param-name=param-value]*
where the characters :, ?, and & stand for themselves. The to represents an RFC 822 mailbox. Valid param-name include:
Parameter Names
param-name Description
subject The subject of the request message.

Some examples of email URIs are: mailto:[email protected]
mailto:[email protected]@?subject=SOAP%20Test

For WebServiceMessageSender.UriSource.APPLICATION, default checks accept any mailto: URI. For WebServiceMessageSender.UriSource.REMOTE, default checks require a well-formed mailbox in the MailDestinationDescriptor (parsable To, extractable host, basic header-injection guards); reject localhost and *.localhost in the mailbox host segment. Use a WebServiceMessageSender.DestinationPolicy for domain allowlists, header rules, or other mail-specific validation.

Since:
1.5.0
See Also:
  • Field Details

    • DEFAULT_RECEIVE_TIMEOUT

      public static final long DEFAULT_RECEIVE_TIMEOUT
      Default timeout for receive operations. Set to 1000 * 60 milliseconds (i.e. 1 minute).
      See Also:
  • Constructor Details

    • MailMessageSender

      public MailMessageSender()
  • Method Details