Class DefaultMailContext
java.lang.Object
de.xima.fc.mail.impl.context.DefaultMailContext
- All Implemented Interfaces:
IMailContext
- Direct Known Subclasses:
MSGraphMailContext, PasswordMailContext
Default implementation for sending mails via smtp
- Author:
- XIMA MEDIA GmbH, Dresden
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Predicate<javax.mail.Address> protected IMailServerData -
Method Summary
Modifier and TypeMethodDescriptionvoidarchive(IBaseMailData mail, Mandant client, File file) Create an archived file of the mail.protected ISendMailReportbuildAndSendMessage(IBaseMailData mail, Mandant client) protected javax.mail.Authenticatorprotected javax.mail.internet.MimeBodyPartbuildBodyPart(BodyPartData body) protected voidbuildContent(IBaseMailData mail, javax.mail.internet.MimeMessage msg, Mandant client) Deprecated, for removal: This API element is subject to removal in a future version.protected org.apache.commons.lang3.tuple.Pair<javax.mail.internet.MimeMessage, IMailSecurityReport> buildContentWithSecurityReport(IBaseMailData mail, javax.mail.internet.MimeMessage msg, Mandant client) protected javax.mail.internet.MimeBodyPartbuildFilePart(FilePartData file) protected Propertiesprotected javax.mail.internet.MimeMessagecreateMimeMessage(IBaseMailData mail, Mandant client) Deprecated, for removal: This API element is subject to removal in a future version.since 8.5.0, usecreateMimeMessageWithSecurityReport(IBaseMailData, Mandant)instead.protected javax.mail.internet.MimeMessagecreateMimeMessage(javax.mail.Session session, IBaseMailData mail, Mandant client) Deprecated, for removal: This API element is subject to removal in a future version.since 8.5.0, usecreateMimeMessageWithSecurityReport(Session, IBaseMailData, Mandant)instead.protected org.apache.commons.lang3.tuple.Pair<javax.mail.internet.MimeMessage, IMailSecurityReport> createMimeMessageWithSecurityReport(IBaseMailData mail, Mandant client) protected org.apache.commons.lang3.tuple.Pair<javax.mail.internet.MimeMessage, IMailSecurityReport> createMimeMessageWithSecurityReport(javax.mail.Session session, IBaseMailData mail, Mandant client) protected final voidenforceSenderAddress(javax.mail.internet.MimeMessage msg, Mandant client) protected javax.mail.Address[]filterAddresses(javax.mail.Address[] addresses) Gets the mail server data of the contextsendWithReport(IBaseMailData mail) Sends a mail based on the given datasendWithReport(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 sendMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IMailContext
send, send, setAddressFilter
-
Field Details
-
addressFilter
-
serverData
-
-
Method Details
-
archive
Description copied from interface:IMailContextCreate an archived file of the mail.- Specified by:
archivein interfaceIMailContext- 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.
-
getServerData
Description copied from interface:IMailContextGets the mail server data of the context- Specified by:
getServerDatain interfaceIMailContext- Returns:
- the server data
-
sendWithReport
Description copied from interface:IMailContextSends a mail based on the given data- Specified by:
sendWithReportin interfaceIMailContext- 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.
-
sendWithReport
Description copied from interface:IMailContextSends a mail based on the given data- Specified by:
sendWithReportin interfaceIMailContext- 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.
-
setAddressFilter
Description copied from interface:IMailContextSets an filter for excluding mail addresses during send- Specified by:
setAddressFilterin interfaceIMailContext- Parameters:
addressFilter- the address filter to set
-
buildAndSendMessage
- Throws:
Exception
-
buildAuthenticator
protected javax.mail.Authenticator buildAuthenticator() -
buildBodyPart
- Throws:
Exception
-
buildContent
@Deprecated(since="8.5.0", forRemoval=true) protected void buildContent(IBaseMailData mail, javax.mail.internet.MimeMessage msg, Mandant client) throws javax.mail.MessagingException Deprecated, for removal: This API element is subject to removal in a future version.since 8.5.0, usebuildContentWithSecurityReport(IBaseMailData, MimeMessage, Mandant)instead.- Throws:
javax.mail.MessagingException
-
buildContentWithSecurityReport
protected org.apache.commons.lang3.tuple.Pair<javax.mail.internet.MimeMessage, IMailSecurityReport> buildContentWithSecurityReport(IBaseMailData mail, javax.mail.internet.MimeMessage msg, Mandant client) throws javax.mail.MessagingException - Throws:
javax.mail.MessagingException
-
buildFilePart
- Throws:
Exception
-
buildProperties
-
createMimeMessage
@Deprecated(since="8.5.0", forRemoval=true) protected javax.mail.internet.MimeMessage createMimeMessage(IBaseMailData mail, Mandant client) throws javax.mail.MessagingException Deprecated, for removal: This API element is subject to removal in a future version.since 8.5.0, usecreateMimeMessageWithSecurityReport(IBaseMailData, Mandant)instead.- Throws:
javax.mail.MessagingException
-
createMimeMessage
@Deprecated(since="8.5.0", forRemoval=true) protected javax.mail.internet.MimeMessage createMimeMessage(javax.mail.Session session, IBaseMailData mail, Mandant client) throws javax.mail.MessagingException Deprecated, for removal: This API element is subject to removal in a future version.since 8.5.0, usecreateMimeMessageWithSecurityReport(Session, IBaseMailData, Mandant)instead.- Throws:
javax.mail.MessagingException
-
createMimeMessageWithSecurityReport
protected org.apache.commons.lang3.tuple.Pair<javax.mail.internet.MimeMessage, IMailSecurityReport> createMimeMessageWithSecurityReport(javax.mail.Session session, IBaseMailData mail, Mandant client) throws javax.mail.MessagingException - Throws:
javax.mail.MessagingException
-
createMimeMessageWithSecurityReport
protected org.apache.commons.lang3.tuple.Pair<javax.mail.internet.MimeMessage, IMailSecurityReport> createMimeMessageWithSecurityReport(IBaseMailData mail, Mandant client) throws javax.mail.MessagingException - Throws:
javax.mail.MessagingException
-
enforceSenderAddress
protected final void enforceSenderAddress(javax.mail.internet.MimeMessage msg, Mandant client) throws javax.mail.MessagingException - Throws:
javax.mail.MessagingException
-
filterAddresses
protected javax.mail.Address[] filterAddresses(javax.mail.Address[] addresses)
-
buildContentWithSecurityReport(IBaseMailData, MimeMessage, Mandant)instead.