Class MailDestinationPolicies
java.lang.Object
org.springframework.ws.transport.mail.MailDestinationPolicies
DestinationPolicy implementations for mail destinations.
A policy is required for a sender to accept a remote
destination, such as a WS-Addressing ReplyTo or FaultTo address:
MailMessageSender sender = new MailMessageSender();
sender.setDestinationPolicy(MailDestinationPolicies.allowedRecipients("[email protected]"));
- Since:
- 3.1.10
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallowedRecipients(String... addresses) Return a policy that accepts a remote destination only if its mailbox is one of the given addresses, and accepts any application-supplied destination.allowedRecipients(Collection<String> addresses) Return a policy that accepts a remote destination only if its mailbox is one of the given addresses, and accepts any application-supplied destination.
-
Constructor Details
-
MailDestinationPolicies
public MailDestinationPolicies()
-
-
Method Details
-
allowedRecipients
public static WebServiceMessageSender.DestinationPolicy<MailDestinationDescriptor> allowedRecipients(String... addresses) Return a policy that accepts a remote destination only if its mailbox is one of the given addresses, and accepts any application-supplied destination.- Parameters:
addresses- the mailboxes to accept- Returns:
- a policy accepting only those mailboxes for remote destinations
- See Also:
-
allowedRecipients
public static WebServiceMessageSender.DestinationPolicy<MailDestinationDescriptor> allowedRecipients(Collection<String> addresses) Return a policy that accepts a remote destination only if its mailbox is one of the given addresses, and accepts any application-supplied destination.Both sides of the comparison are the address of a mailbox parsed by JavaMail, so what is compared is the mailbox that the message would be sent to. The comparison is exact, including the case of the local part, which only the receiving mail system can declare insignificant. A mailbox that differs in any way, including one carrying anything beyond an address, therefore does not match a configured recipient.
Each configured address must be a single well-formed mailbox, as parsed in strict mode.
- Parameters:
addresses- the mailboxes to accept- Returns:
- a policy accepting only those mailboxes for remote destinations
- Throws:
IllegalArgumentException- if no address is given, or an address is not a well-formed mailbox
-