}
private RemotePart calculateRewrittenRemotePart() {
if (originalRecipient.isGlobalPostmaster()) {
if (defaultRemotePart == null)
throw new ConfigurationException(
"Mails sent to the global Postmaster are "
+ "forwarded, but "
+ "no default domain is specified "
+ "which can be used in SRS.");
return defaultRemotePart;
}
RemotePartContainingRecipient remotePartContainingRecipient =
(RemotePartContainingRecipient) originalRecipient;
RemotePart recipientRemotePart =
remotePartContainingRecipient.getMailbox().getRemotePart();
if (localDomains == null
|| localDomains.isSatisfiedBy(recipientRemotePart)) {
return recipientRemotePart;
} else {
if (defaultRemotePart == null)
throw new ConfigurationException(
"The domain of a forwarded address does not "
+ "authorizes this server to send mail, "
+ "and no default domain is defined "
+ "which can be used in SRS.");
return defaultRemotePart;