Class MailContextProvider


  • public final class MailContextProvider
    extends Object
    Provider for managing informations an contexts for mail server
    Author:
    XIMA MEDIA GmbH, Dresden
    • Method Detail

      • setMailContextFactory

        public static void setMailContextFactory​(IMailContextFactory factory)
        Sets an custom mail context factory
        Parameters:
        factory - the custom facytory
      • getContextFor

        public static IMailContext getContextFor​(IMailServerData serverData)
        Creates an mail context for the given server data
        Parameters:
        serverData - the server data
        Returns:
        the mail context
      • getContextFor

        public static IMailContext getContextFor​(MandantMailData mailData)
        Creates an mail context for the given client mail data
        Parameters:
        mailData - the client mail data
        Returns:
        an mail context or null
      • getSystemContext

        public static IMailContext getSystemContext()
        Creates an mail context for the system mail server
        Returns:
        the mail context or null
      • getSenderFromContext

        public static javax.mail.Address getSenderFromContext​(UserContext uc,
                                                              Mandant client)
                                                       throws javax.mail.internet.AddressException,
                                                              UnsupportedEncodingException
        Gets the sender
        Parameters:
        uc - the user context
        client - the client
        Returns:
        the sender address
        Throws:
        javax.mail.internet.AddressException - if the sender name address is invalid
        UnsupportedEncodingException - if the sender name can not be encoded
      • getSenderFromContext

        public static javax.mail.Address getSenderFromContext​(Mandant client)
                                                       throws javax.mail.internet.AddressException,
                                                              UnsupportedEncodingException
        Gets the sender
        Parameters:
        client - the client
        Returns:
        the sender address
        Throws:
        javax.mail.internet.AddressException - if the sender name address is invalid
        UnsupportedEncodingException - if the sender name can not be encoded
      • getContextFor

        public static IMailContext getContextFor​(Mandant client)
        Creates an mail context for the given client
        Parameters:
        client - the client
        Returns:
        an mail context or null
      • getAuthenticatorFor

        @Deprecated
        public static javax.mail.Authenticator getAuthenticatorFor​(String username,
                                                                   String password)
        Deprecated.
        build your own Authenticator