Class Srs


  • public class Srs
    extends Object
    The 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 Detail

      • SRS0_PREFIX

        public static final java.util.regex.Pattern SRS0_PREFIX
      • SRS1_PREFIX

        public static final java.util.regex.Pattern SRS1_PREFIX
    • Constructor Detail

      • Srs

        public Srs()
    • 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 forwarded
        originalRecipient - the mail was received for this recipient, which recipient address is configured to forward mail to another address.
      • 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 the localDomains field, 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