public class DirectImmediateSender extends Object implements ImmediateSender
The remote domain is specified by the remote part of the recipient addresses, which must be the same for all recipients in case of this implementation.
The receiving SMTP servers are usually specified by the MX records of the remote domain, except if the remote part is a literal address, or the domain has an implicit MX record only.
If it cannot transmit the mail to any of the MX hosts of the domain, then it throws an exception, it does not retry later.
TODO: if a recipient is rejected because of a transient failure, then it should be retried on another host.
Constructor and Description |
---|
DirectImmediateSender() |
Modifier and Type | Method and Description |
---|---|
AddressLookup |
getAddressLookup() |
ClientFactory |
getClientFactory() |
MailToHostTransmitter |
getMailToHostTransmitter() |
MxLookup |
getMxLookup() |
void |
send(Mail mail)
Transmits mail to a single domain.
|
void |
setAddressLookup(AddressLookup addressLookup) |
void |
setClientFactory(ClientFactory clientFactory) |
void |
setMailToHostTransmitter(MailToHostTransmitter mailToHostTransmitter) |
void |
setMxLookup(MxLookup mxLookup) |
boolean |
singleDomainOnly()
Returns true if the created
ImmediateSender requires that all
recipients of the mail to be sent have the same remote-part. |
public boolean singleDomainOnly()
ImmediateSender
ImmediateSender
requires that all
recipients of the mail to be sent have the same remote-part.singleDomainOnly
in interface ImmediateSender
public void send(Mail mail) throws SendException, RecipientsWereRejectedException, IllegalArgumentException, PostponeException
send
in interface ImmediateSender
IllegalArgumentException
- if the domains of the recipients are not the same, or if the
recipient is the special global postmaster address, which has
no absolute domain.PostponeException
- if transmission to all of the hosts must be postponed,
because all of them are assumed to be busy at this moment.SendException
RecipientsWereRejectedException
public MxLookup getMxLookup()
public void setMxLookup(MxLookup mxLookup)
public AddressLookup getAddressLookup()
public void setAddressLookup(AddressLookup addressLookup)
public ClientFactory getClientFactory()
@Inject public void setClientFactory(ClientFactory clientFactory)
public MailToHostTransmitter getMailToHostTransmitter()
public void setMailToHostTransmitter(MailToHostTransmitter mailToHostTransmitter)