Package de.xima.fc.mail.impl.context
Class DefaultMailContext
- java.lang.Object
- 
- de.xima.fc.mail.impl.context.DefaultMailContext
 
- 
- All Implemented Interfaces:
- IMailContext
 - Direct Known Subclasses:
- MSGraphMailContext,- PasswordMailContext
 
 public class DefaultMailContext extends Object implements IMailContext Default implementation for sending mails via smtp- Author:
- XIMA MEDIA GmbH, Dresden
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected Predicate<javax.mail.Address>addressFilterprotected IMailServerDataserverData
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidarchive(IBaseMailData mail, Mandant client, File file)Create an archived file of the mail.protected ISendMailReportbuildAndSendMessage(IBaseMailData mail, Mandant client)protected javax.mail.AuthenticatorbuildAuthenticator()protected javax.mail.internet.MimeBodyPartbuildBodyPart(BodyPartData body)protected voidbuildContent(IBaseMailData mail, javax.mail.internet.MimeMessage msg, Mandant client)protected javax.mail.internet.MimeBodyPartbuildFilePart(FilePartData file)protected PropertiesbuildProperties()protected javax.mail.internet.MimeMessagecreateMimeMessage(IBaseMailData mail, Mandant client)protected javax.mail.internet.MimeMessagecreateMimeMessage(javax.mail.Session session, IBaseMailData mail, Mandant client)protected voidenforceSenderAddress(javax.mail.internet.MimeMessage msg, Mandant client)protected javax.mail.Address[]filterAddresses(javax.mail.Address[] addresses)IMailServerDatagetServerData()Gets the mail server data of the contextISendMailReportsendWithReport(IBaseMailData mail)Sends a mail based on the given dataISendMailReportsendWithReport(IBaseMailData mail, Mandant client)Sends a mail based on the given datavoidsetAddressFilter(Predicate<javax.mail.Address> addressFilter)Sets an filter for excluding mail addresses during send- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface de.xima.fc.mail.interfaces.IMailContextsend, send, setAddressFilter
 
- 
 
- 
- 
- 
Field Detail- 
addressFilterprotected Predicate<javax.mail.Address> addressFilter 
 - 
serverDataprotected IMailServerData serverData 
 
- 
 - 
Method Detail- 
getServerDatapublic IMailServerData getServerData() Description copied from interface:IMailContextGets the mail server data of the context- Specified by:
- getServerDatain interface- IMailContext
- Returns:
- the server data
 
 - 
setAddressFilterpublic void setAddressFilter(Predicate<javax.mail.Address> addressFilter) Description copied from interface:IMailContextSets an filter for excluding mail addresses during send- Specified by:
- setAddressFilterin interface- IMailContext
- Parameters:
- addressFilter- the address filter to set
 
 - 
buildAuthenticatorprotected javax.mail.Authenticator buildAuthenticator() 
 - 
buildPropertiesprotected Properties buildProperties() 
 - 
sendWithReportpublic ISendMailReport sendWithReport(IBaseMailData mail) throws Exception Description copied from interface:IMailContextSends a mail based on the given data- Specified by:
- sendWithReportin interface- IMailContext
- Parameters:
- mail- Data with the mail or mails to sent.
- Returns:
- Information about the mails that were actually sent.
- Throws:
- Exception- When the mail could not be sent, e.g. due to network errors or invalid mail addresses.
 
 - 
sendWithReportpublic ISendMailReport sendWithReport(IBaseMailData mail, Mandant client) throws Exception Description copied from interface:IMailContextSends a mail based on the given data- Specified by:
- sendWithReportin interface- IMailContext
- Parameters:
- mail- Data with the mail or mails to sent.
- client- The client scope to use for placeholder replacements
- Returns:
- Information about the mails that were actually sent.
- Throws:
- Exception- When the mail could not be sent, e.g. due to network errors or invalid mail addresses.
 
 - 
archivepublic void archive(IBaseMailData mail, Mandant client, File file) throws Exception Description copied from interface:IMailContextCreate an archived file of the mail.- Specified by:
- archivein interface- IMailContext
- Parameters:
- mail- Data of the email to send.
- client- The client to use for placeholder replacements.
- file- The file to write to.
- Throws:
- Exception- When the archive file could not be created.
 
 - 
buildAndSendMessageprotected ISendMailReport buildAndSendMessage(IBaseMailData mail, Mandant client) throws Exception - Throws:
- Exception
 
 - 
enforceSenderAddressprotected final void enforceSenderAddress(javax.mail.internet.MimeMessage msg, Mandant client) throws javax.mail.MessagingException- Throws:
- javax.mail.MessagingException
 
 - 
createMimeMessageprotected javax.mail.internet.MimeMessage createMimeMessage(IBaseMailData mail, Mandant client) throws javax.mail.MessagingException - Throws:
- javax.mail.MessagingException
 
 - 
createMimeMessageprotected javax.mail.internet.MimeMessage createMimeMessage(javax.mail.Session session, IBaseMailData mail, Mandant client) throws javax.mail.MessagingException- Throws:
- javax.mail.MessagingException
 
 - 
filterAddressesprotected javax.mail.Address[] filterAddresses(javax.mail.Address[] addresses) 
 - 
buildContentprotected void buildContent(IBaseMailData mail, javax.mail.internet.MimeMessage msg, Mandant client) throws javax.mail.MessagingException - Throws:
- javax.mail.MessagingException
 
 - 
buildBodyPartprotected javax.mail.internet.MimeBodyPart buildBodyPart(BodyPartData body) throws Exception - Throws:
- Exception
 
 - 
buildFilePartprotected javax.mail.internet.MimeBodyPart buildFilePart(FilePartData file) throws Exception - Throws:
- Exception
 
 
- 
 
-