Package mireka.forward
Class Srs
- Object
-
- mireka.forward.Srs
-
public class Srs extends ObjectThe Srs class implements the Sender Rewriting Scheme (SRS), which makes possible to forward mail without breaking SPF checks.Note: sender rewriting is not necessary if the reverse path is local.
- See Also:
- SRS
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.PatternSRS0_PREFIXstatic java.util.regex.PatternSRS1_PREFIX
-
Constructor Summary
Constructors Constructor Description Srs()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReversePathforward(ReversePath reversePath, Recipient originalRecipient)Returns a reverse path which can be used in the forwarded mail.RemotePartgetDefaultRemotePart()RemotePartSpecificationgetLocalDomains()intgetMaximumAge()StringgetSecretKey()Recipientreverse(Recipient srsRecipient)voidsetDefaultRemotePart(String defaultRemotePart)voidsetDefaultRemotePart(RemotePart defaultRemotePart)Sets the remote part used in the rewritten reverse path for those recipients whose domain does not appear in thelocalDomainsfield, but for some reason mails to those domains are accepted.voidsetLocalDomains(RemotePartSpecification localDomains)Sets the domains which authorize this server to send mail in their name using the SPF DNS record.voidsetMaximumAge(int maximumAge)voidsetSecretKey(String secretKey)Sets the secret key as a HEX string.voidsetSecretKeyString(String secretKey)Sets the secret key by encoding the supplied String with UTF-8 to get the key bytes.
-
-
-
Method Detail
-
forward
public ReversePath forward(ReversePath reversePath, Recipient originalRecipient)
Returns a reverse path which can be used in the forwarded mail.- Parameters:
reversePath- the reversePath which with our server received the mail to be forwardedoriginalRecipient- the mail was received for this recipient, which recipient address is configured to forward mail to another address.
-
reverse
public Recipient reverse(Recipient srsRecipient) throws InvalidSrsException
- Throws:
InvalidSrsException
-
getLocalDomains
public RemotePartSpecification getLocalDomains()
- Category:
- GETSET
-
setLocalDomains
public void setLocalDomains(RemotePartSpecification localDomains)
Sets the domains which authorize this server to send mail in their name using the SPF DNS record. Reverse paths from these domains will not be rewritten. If not set, than it is assumed that the domain of any accepted mail authorizes this server to send mail in its name.- Category:
- GETSET
-
getDefaultRemotePart
public RemotePart getDefaultRemotePart()
- Category:
- GETSET
-
setDefaultRemotePart
public void setDefaultRemotePart(RemotePart defaultRemotePart)
Sets the remote part used in the rewritten reverse path for those recipients whose domain does not appear in thelocalDomainsfield, but for some reason mails to those domains are accepted. For example mail sent to the global Postmaster address has no domain at all.- Category:
- GETSET
-
setDefaultRemotePart
public void setDefaultRemotePart(String defaultRemotePart)
- Category:
- GETSET
-
getSecretKey
public String getSecretKey()
- Category:
- GETSET
-
setSecretKey
public void setSecretKey(String secretKey)
Sets the secret key as a HEX string. It should be long enough to be hard to recover with a brute force attack.- Category:
- GETSET
-
setSecretKeyString
public void setSecretKeyString(String secretKey)
Sets the secret key by encoding the supplied String with UTF-8 to get the key bytes.- Category:
- GETSET
-
setMaximumAge
public void setMaximumAge(int maximumAge)
- Category:
- GETSET
-
getMaximumAge
public int getMaximumAge()
- Category:
- GETSET
-
-