public class DefaultEmailService extends java.lang.Object implements EmailService
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EMAIL_BODY_ENCODING
Deprecated.
As of release 6.7, replaced by
StandardCharsets.UTF_8 |
static int |
EMAIL_BODY_MAX_LENGTH |
static java.lang.String |
EMAIL_BODY_MAX_LENGTH_KEY |
static java.lang.String |
EMAIL_BODY_MIME_TYPE |
static java.lang.String |
EMAILSERVICE_SEND_ENABLED_CONFIG_KEY |
| Constructor and Description |
|---|
DefaultEmailService() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addReplyTo(EmailMessageModel message,
HtmlEmail email) |
protected java.util.List<java.lang.String> |
convertToStrings(java.util.List<EmailAddressModel> addresses) |
protected MediaModel |
createBodyMedia(java.lang.String bodyMediaName,
java.lang.String body)
Method creates MediaModel object for storing email body
|
EmailAttachmentModel |
createEmailAttachment(java.io.DataInputStream masterDataStream,
java.lang.String filename,
java.lang.String mimeType)
Creates an email attachment from an input stream.
|
EmailMessageModel |
createEmailMessage(java.util.List<EmailAddressModel> toAddresses,
java.util.List<EmailAddressModel> ccAddresses,
java.util.List<EmailAddressModel> bccAddresses,
EmailAddressModel fromAddress,
java.lang.String replyToAddress,
java.lang.String subject,
java.lang.String body,
java.util.List<EmailAttachmentModel> attachments)
Creates and EmailMessage object.
|
protected InternetAddress |
createInternetAddress(java.lang.String emailAddress,
java.lang.String displayName) |
protected java.util.Collection<InternetAddress> |
getAddresses(java.util.List<EmailAddressModel> emailAddresses) |
protected java.lang.String |
getBody(EmailMessageModel message)
Method checks which attribute is storing email body (bodyMedia or body) and return its content as string
|
protected CatalogService |
getCatalogService() |
protected CatalogVersionModel |
getCatalogVersion() |
protected CatalogVersionService |
getCatalogVersionService() |
protected ConfigurationService |
getConfigurationService() |
protected EmailAddressFetchStrategy |
getEmailAddressFetchStrategy() |
protected MediaFolderModel |
getEmailAttachmentsMediaFolder() |
protected java.lang.String |
getEmailAttachmentsMediaFolderName() |
protected MediaFolderModel |
getEmailBodyMediaFolder() |
protected java.lang.String |
getEmailBodyMediaFolderName() |
protected MediaService |
getMediaService() |
protected ModelService |
getModelService() |
EmailAddressModel |
getOrCreateEmailAddressForEmail(java.lang.String emailAddress,
java.lang.String displayName)
Returns a
EmailAddressModel. |
protected HtmlEmail |
getPerConfiguredEmail() |
protected void |
logDebugException(java.lang.Exception e) |
protected void |
logInfo(EmailMessageModel message,
EmailException e) |
protected java.lang.String |
nullifyEmpty(java.lang.String str) |
protected boolean |
processAttachmentsSuccessful(HtmlEmail email,
java.util.List<EmailAttachmentModel> attachments) |
boolean |
send(EmailMessageModel message)
Sends an email
|
protected void |
setAddresses(EmailMessageModel message,
HtmlEmail email,
java.util.List<EmailAddressModel> toAddresses) |
void |
setCatalogService(CatalogService catalogService) |
void |
setCatalogVersionService(CatalogVersionService catalogVersionService) |
void |
setConfigurationService(ConfigurationService configurationService) |
void |
setEmailAddressFetchStrategy(EmailAddressFetchStrategy emailAddressFetchStrategy) |
void |
setEmailAttachmentsMediaFolderName(java.lang.String emailAttachmentsMediaFolderName) |
void |
setEmailBodyMediaFolderName(java.lang.String emailBodyMediaFolderName) |
void |
setMediaService(MediaService mediaService) |
void |
setModelService(ModelService modelService) |
protected void |
validateAddresses(java.util.List<EmailAddressModel> toAddresses,
EmailAddressModel fromAddress) |
protected void |
validateContent(java.lang.String subject,
java.lang.String body) |
protected void |
validateEmailAddress(java.lang.String address,
java.lang.String type) |
@Deprecated public static final java.lang.String EMAIL_BODY_ENCODING
StandardCharsets.UTF_8public static final java.lang.String EMAILSERVICE_SEND_ENABLED_CONFIG_KEY
public static final int EMAIL_BODY_MAX_LENGTH
public static final java.lang.String EMAIL_BODY_MAX_LENGTH_KEY
public static final java.lang.String EMAIL_BODY_MIME_TYPE
public EmailAddressModel getOrCreateEmailAddressForEmail(java.lang.String emailAddress, java.lang.String displayName)
EmailServiceEmailAddressModel. Instance is found for the given email address and display name criteria. If
there is no instance for this condition the new EmailAddressModel instance is returned based on the given
criteria.getOrCreateEmailAddressForEmail in interface EmailServiceemailAddress - Email iddisplayName - Display namepublic EmailAttachmentModel createEmailAttachment(java.io.DataInputStream masterDataStream, java.lang.String filename, java.lang.String mimeType)
EmailServicecreateEmailAttachment in interface EmailServicemasterDataStream - Input data streamfilename - File namemimeType - Mime typeprotected MediaFolderModel getEmailAttachmentsMediaFolder()
protected MediaFolderModel getEmailBodyMediaFolder()
public EmailMessageModel createEmailMessage(java.util.List<EmailAddressModel> toAddresses, java.util.List<EmailAddressModel> ccAddresses, java.util.List<EmailAddressModel> bccAddresses, EmailAddressModel fromAddress, java.lang.String replyToAddress, java.lang.String subject, java.lang.String body, java.util.List<EmailAttachmentModel> attachments)
EmailServicecreateEmailMessage in interface EmailServicetoAddresses - List of To email addressesccAddresses - List of CC email addressesbccAddresses - List of BCC email addressesfromAddress - From email addressreplyToAddress - Reply To email addresssubject - Subject of the emailbody - Contents of the emailattachments - List of email attachmentsprotected void validateAddresses(java.util.List<EmailAddressModel> toAddresses, EmailAddressModel fromAddress)
protected void validateContent(java.lang.String subject,
java.lang.String body)
protected MediaModel createBodyMedia(java.lang.String bodyMediaName, java.lang.String body)
bodyMediaName - - name for created objectbody - - content of email bodyprotected CatalogVersionModel getCatalogVersion()
protected void validateEmailAddress(java.lang.String address,
java.lang.String type)
public boolean send(EmailMessageModel message)
EmailServicesend in interface EmailServicemessage - EmailMessageprotected void addReplyTo(EmailMessageModel message, HtmlEmail email) throws EmailException
EmailExceptionprotected void logInfo(EmailMessageModel message, EmailException e)
protected boolean processAttachmentsSuccessful(HtmlEmail email,
java.util.List<EmailAttachmentModel> attachments)
protected void setAddresses(EmailMessageModel message, HtmlEmail email, java.util.List<EmailAddressModel> toAddresses) throws EmailException
EmailExceptionprotected HtmlEmail getPerConfiguredEmail()
throws EmailException
EmailExceptionprotected java.lang.String getBody(EmailMessageModel message)
message - - email message objectprotected java.lang.String nullifyEmpty(java.lang.String str)
protected java.util.Collection<InternetAddress> getAddresses(java.util.List<EmailAddressModel> emailAddresses)
protected InternetAddress createInternetAddress(java.lang.String emailAddress,
java.lang.String displayName)
throws EmailException
EmailExceptionprotected java.util.List<java.lang.String> convertToStrings(java.util.List<EmailAddressModel> addresses)
protected void logDebugException(java.lang.Exception e)
protected EmailAddressFetchStrategy getEmailAddressFetchStrategy()
public void setEmailAddressFetchStrategy(EmailAddressFetchStrategy emailAddressFetchStrategy)
protected java.lang.String getEmailAttachmentsMediaFolderName()
public void setEmailAttachmentsMediaFolderName(java.lang.String emailAttachmentsMediaFolderName)
protected java.lang.String getEmailBodyMediaFolderName()
public void setEmailBodyMediaFolderName(java.lang.String emailBodyMediaFolderName)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
protected MediaService getMediaService()
public void setMediaService(MediaService mediaService)
protected ConfigurationService getConfigurationService()
public void setConfigurationService(ConfigurationService configurationService)
protected CatalogVersionService getCatalogVersionService()
public void setCatalogVersionService(CatalogVersionService catalogVersionService)
protected CatalogService getCatalogService()
public void setCatalogService(CatalogService catalogService)
Copyright © 2018 SAP SE. All Rights Reserved.