Package de.xima.fc.mail
Class MailContextProvider
java.lang.Object
de.xima.fc.mail.MailContextProvider
Provider for managing informations an contexts for mail server
- Author:
- XIMA MEDIA GmbH, Dresden
-
Method Summary
Modifier and TypeMethodDescriptionstatic javax.mail.Authenticator
getAuthenticatorFor
(String username, String password) Deprecated.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
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 Details
-
setMailContextFactory
Sets an custom mail context factory- Parameters:
factory
- the custom facytory
-
getContextFor
Creates an mail context for the given server data- Parameters:
serverData
- the server data- Returns:
- the mail context
-
getContextFor
Creates an mail context for the given client mail data- Parameters:
mailData
- the client mail data- Returns:
- an mail context or
null
-
getSystemContext
Creates an mail context for the system mail server- Returns:
- the mail context or
null
-
getSystemContext
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
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
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
-
Authenticator