Class MailContextProvider

java.lang.Object
de.xima.fc.mail.MailContextProvider

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

    • 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
    • getSystemContext

      public static IMailContext getSystemContext(MandantMailData mailData)
      Creates an mail context for the system mail server
      Parameters:
      mailData - Client mail data, if available, when the mail is sent within the context of a client, such as from workflow actions. May be null otherwise.
      Returns:
      the mail context or null
    • getSystemContext

      public static IMailContext getSystemContext(Mandant client)
      Creates an mail context for the system mail server
      Parameters:
      client - Client, if available, when the mail is sent within the context of a client, such as from workflow actions. May be null otherwise.
      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
    • getContextFor

      @Deprecated public static IMailContext getContextFor(String server, Integer port, javax.mail.Authenticator auth, EMailEncryption encryption)
      Parameters:
      server - Email server host.
      port - Email server port.
      auth - Authenticator, if any is required by the server.
      encryption - Encryption to use, if any.
      Returns:
      A new mail context for sending mails.
    • getContextFor

      @Deprecated public static IMailContext getContextFor(String server, Integer port, javax.mail.Authenticator auth, EMailEncryption encryption, boolean allowUtf8)
    • getAuthenticatorFor

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