Package de.xima.fc.mail
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 Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static javax.mail.Authenticator
getAuthenticatorFor(String username, String password)
Deprecated.build your ownAuthenticator
static IMailContext
getContextFor(Mandant client)
Creates an mail context for the given clientstatic IMailContext
getContextFor(MandantMailData mailData)
Creates an mail context for the given client mail datastatic IMailContext
getContextFor(IMailServerData serverData)
Creates an mail context for the given server datastatic IMailContext
getContextFor(String server, Integer port, javax.mail.Authenticator auth, EMailEncryption encryption)
static IMailContext
getContextFor(String server, Integer port, javax.mail.Authenticator auth, EMailEncryption encryption, boolean allowUtf8)
Deprecated.static javax.mail.Address
getSenderFromContext(Mandant client)
Gets the senderstatic javax.mail.Address
getSenderFromContext(UserContext uc, Mandant client)
Gets the senderstatic IMailContext
getSystemContext()
Creates an mail context for the system mail serverstatic IMailContext
getSystemContext(Mandant client)
Creates an mail context for the system mail serverstatic IMailContext
getSystemContext(MandantMailData mailData)
Creates an mail context for the system mail serverstatic void
setMailContextFactory(IMailContextFactory factory)
Sets an custom mail context factory
-
-
-
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
-
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 benull
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 benull
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 contextclient
- the client- Returns:
- the sender address
- Throws:
javax.mail.internet.AddressException
- if the sender name address is invalidUnsupportedEncodingException
- 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 invalidUnsupportedEncodingException
- 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)
Deprecated.
-
getAuthenticatorFor
@Deprecated public static javax.mail.Authenticator getAuthenticatorFor(String username, String password)
Deprecated.build your ownAuthenticator
-
-