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 Summary
Fields Modifier and Type Field Description protected de.xima.cmn.filter.IGenericFilter<javax.mail.Address>addressFilterprotected IMailServerDataserverData
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuildAndSendMessage(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(javax.mail.Session session, IBaseMailData mail, Mandant client)protected javax.mail.Address[]filterAddresses(javax.mail.Address[] addresses)protected de.xima.cmn.filter.IGenericFilter<javax.mail.Address>getAddressFilter()IMailServerDatagetServerData()Gets the mail server data of the contextvoidsend(IBaseMailData mail)Sends an mail based on the given datavoidsend(IBaseMailData mail, Mandant client)Sends an mail based on the given datavoidsetAddressFilter(de.xima.cmn.filter.IGenericFilter<javax.mail.Address> addressFilter)Sets an filter for excluding mail addresses during send
-
-
-
Field Detail
-
addressFilter
protected de.xima.cmn.filter.IGenericFilter<javax.mail.Address> addressFilter
-
serverData
protected IMailServerData serverData
-
-
Method Detail
-
getServerData
public IMailServerData getServerData()
Description copied from interface:IMailContextGets the mail server data of the context- Specified by:
getServerDatain interfaceIMailContext- Returns:
- the server data
-
setAddressFilter
public void setAddressFilter(de.xima.cmn.filter.IGenericFilter<javax.mail.Address> addressFilter)
Description copied from interface:IMailContextSets an filter for excluding mail addresses during send- Specified by:
setAddressFilterin interfaceIMailContext- Parameters:
addressFilter- the address filter to set
-
getAddressFilter
protected de.xima.cmn.filter.IGenericFilter<javax.mail.Address> getAddressFilter()
-
buildAuthenticator
protected javax.mail.Authenticator buildAuthenticator()
-
buildProperties
protected Properties buildProperties()
-
send
public void send(IBaseMailData mail) throws Exception
Description copied from interface:IMailContextSends an mail based on the given data- Specified by:
sendin interfaceIMailContext- Parameters:
mail- the mail data- Throws:
Exception- on errors while sending the mail
-
send
public void send(IBaseMailData mail, Mandant client) throws Exception
Description copied from interface:IMailContextSends an mail based on the given data- Specified by:
sendin interfaceIMailContextclient- the client to use for placeholder replacements- Throws:
Exception- on errors while sending the mail
-
buildAndSendMessage
protected void buildAndSendMessage(IBaseMailData mail, Mandant client) throws Exception
- Throws:
Exception
-
createMimeMessage
protected javax.mail.internet.MimeMessage createMimeMessage(javax.mail.Session session, IBaseMailData mail, Mandant client) throws javax.mail.MessagingException- Throws:
javax.mail.MessagingException
-
filterAddresses
protected javax.mail.Address[] filterAddresses(javax.mail.Address[] addresses)
-
buildContent
protected void buildContent(IBaseMailData mail, javax.mail.internet.MimeMessage msg, Mandant client) throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
-
buildBodyPart
protected javax.mail.internet.MimeBodyPart buildBodyPart(BodyPartData body) throws Exception
- Throws:
Exception
-
buildFilePart
protected javax.mail.internet.MimeBodyPart buildFilePart(FilePartData file) throws Exception
- Throws:
Exception
-
-