public class AdminEmailMgr extends AdminBaseMgr implements AdminEmailMgrIf
Modifier and Type | Class and Description |
---|---|
protected class |
AdminEmailMgr.StaticData
Used to store the external mail module
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
debugEmail
debugEmail
|
protected java.lang.String |
defaultBccEmails
defaultBccEmails
|
protected boolean |
displayPricesWithTax
displayPricesWithTax
|
protected static java.lang.String |
emailMgrMutex
Mutex for the email manager
|
protected java.lang.String |
imageBase
imageBase
|
protected static org.apache.commons.logging.Log |
log
the log
|
protected java.lang.String |
logFileDirectory
logFileDirectory
|
protected static java.lang.String |
NEW_PASSWORD_TEMPLATE
global static constant
|
protected static java.lang.String |
ORDER_STATUS_CHANGE_TEMPLATE
global static constant
|
protected java.lang.String |
pdfBase
pdfBase
|
protected static java.util.Map<java.lang.String,AdminEmailMgr.StaticData> |
staticDataHM
Hash Map that contains the static data
|
protected java.lang.String |
storeName
storeName
|
protected java.lang.String |
storeOwner
storeOwner
|
protected java.lang.String |
storeOwnerEmailAddr
storeOwnerEmailAddr
|
protected java.lang.String |
storeUrl
storeUrl
|
protected java.lang.String |
sysAdminEmailAddress
sysAdminEmailAddress
|
adminEng, baseMgrMutex, baseStaticDataHM, cDataEnd, cDataStart, debugStackTraceExclusions, kkAdminPropsFilePath, kkConf, kkInstanceId, mgrFactory, STORE_ID, templateBaseDir
Constructor and Description |
---|
AdminEmailMgr(KKAdminIf eng)
Constructor
|
Modifier and Type | Method and Description |
---|---|
private boolean |
getAsyncFromSynchronousity(int synchcronousity,
boolean def) |
protected com.konakart.bl.EmailConfig |
getConfigData()
Return an EmailConfig object that contains attributes required to configure the eMail.
|
private java.lang.String |
getContentTypeStr(int contentType) |
com.konakart.bl.Emailer |
getEmailer() |
protected javax.mail.Address |
getMailAddressFromString(java.lang.String addrString)
Return an Address for the specified String.
|
org.apache.velocity.VelocityContext |
getVelocityContext()
Returns the Velocity Context
|
protected org.apache.velocity.app.VelocityEngine |
getVelocityEngine()
Returns the Velocity engine
|
protected boolean |
isExternalMailEnabled(AdminEmailMgr.StaticData sd)
Method to determine whether an external mail module is enabled
|
void |
notifySysAdmin(java.lang.String message,
AdminEmailOptions options)
This method is used to send a template based eMail to the System Administrator.
|
void |
refreshConfigs()
Setup the external mail module class.
|
protected void |
refreshPrivateConfigs()
Setup variables needed to send the mail.
|
void |
saveEmailContents(java.lang.String toAddr,
int contentType,
java.lang.String templateName,
boolean doBCC,
java.lang.String subject,
java.lang.String body,
java.lang.String addTofileName)
Write the mail contents to a file which is handy for diagnosing problems
|
boolean |
sendEmail(AdminEmail adminEmailData)
To send an email
|
protected boolean |
sendExternalMail(org.apache.velocity.VelocityContext context,
java.lang.String konakartAPI,
java.lang.String emailAddr,
com.konakart.app.EmailTemplate emailTemplate,
AdminEmailOptions options,
AdminEmail adminEmailData)
If an external mail module has been defined and it is active then it is called to send the
mail
|
void |
sendHTML(AdminEmail adminEmailData,
boolean async)
Send a HTML-only email message to the specified recipient, with the specified subject and
HTML content.
|
void |
sendHTML(java.lang.String toAddressString,
java.lang.String theSubject,
java.lang.String theContentHTML,
boolean doBlindCopy,
java.lang.String bccEmails,
boolean async)
Send a HTML-only email message to the specified recipient, with the specified subject and
HTML content.
|
void |
sendHTML(java.lang.String toAddressString,
java.lang.String theSubject,
java.lang.String theContentHTML,
boolean doBlindCopy,
java.lang.String fullAttachmentFilename,
java.lang.String friendlyAttachmentName,
boolean deleteAttachmentAfterSend,
java.lang.String bccEmails,
boolean async)
Send a HTML-only email message to the specified recipient, with the specified subject and
HTML content.
|
void |
sendMail(int contentTypeIn,
java.lang.String toAddressString,
java.lang.String theSubject,
java.lang.String theContent,
boolean doBlindCopy,
boolean async)
Send an email message to the specified recipient, with the specified subject and content with
the specified Content Type.
|
void |
sendMail(int contentTypeIn,
java.lang.String toAddressString,
java.lang.String theSubject,
java.lang.String theContent,
boolean doBlindCopy,
boolean async,
AdminEmailOptions optionsIn)
Send an email message to the specified recipient, with the specified subject and content with
the specified Content Type.
|
void |
sendNewPasswordEmail(java.lang.String emailAddr,
java.lang.String newPassword,
java.lang.String mailSubjectIn,
java.lang.String countryCode)
Deprecated.
|
void |
sendNewPasswordEmail1(java.lang.String emailAddr,
java.lang.String newPassword,
java.lang.String countryCode)
Send out an email notifying a user of a new password.
|
void |
sendStatusChangeEmail(int orderId)
A status change email is sent when the status of an order is changed
|
void |
sendStatusChangeEmailForState(AdminOrder order,
int state)
A status change email is sent when the status of an order is changed.
|
void |
sendStatusChangeEmailForState(int orderId,
int state)
A status change email is sent when the status of an order is changed.
|
protected void |
sendStatusChangeEmailPrivate(AdminOrder orderIn,
int orderId,
int state)
A status change email is sent when the status of an order is changed.
|
void |
sendTemplateEmail(AdminCustomer customer,
java.lang.String templateName,
java.lang.Object obj1,
java.lang.Object obj2,
java.lang.Object obj3,
java.lang.Object obj4,
java.lang.Object obj5,
AdminEmailOptions optionsIn)
An email is sent to the customer.
|
void |
sendText(java.lang.String toAddressString,
java.lang.String theSubject,
java.lang.String theContentText,
boolean doBlindCopy,
java.lang.String bccEmails,
boolean async)
Send a text-only email message to the specified recipient, with the specified subject and
text content.
|
void |
sendText(java.lang.String toAddressString,
java.lang.String fromAddressString,
java.lang.String replyToAddressString,
java.lang.String theSubject,
java.lang.String theContentText,
boolean doBlindCopy,
java.lang.String bccEmails,
boolean async)
Send a text-only email message to the specified recipient, with the specified subject and
text content.
|
protected void |
setInstalledExternalMailModule(AdminEmailMgr.StaticData sd)
Determines whether an external email module is installed and sets it on the static data if it
is.
|
addInsertAttr, addInsertAttr, addStringRuleConstraint, addStringRuleConstraint, checkAPICallEnabled, checkIntInRange, checkIntIsSet, checkRequired, executeQuery, executeQuery, getAdminAddressMgr, getAdminAuditMgr, getAdminBillingMgr, getAdminBookableProductMgr, getAdminCatMgr, getAdminConfigMgr, getAdminContentMgr, getAdminCurrMgr, getAdminCustMgr, getAdminCustPwdHistMgr, getAdminCustTagMgr, getAdminEmailMgr, getAdminEng, getAdminEngineCacheMgr, getAdminEventMgr, getAdminExecuteMgr, getAdminFileMgr, getAdminFilterMgr, getAdminHtmlMgr, getAdminImportMgr, getAdminLanguageMgr, getAdminManuMgr, getAdminMessageMgr, getAdminMiscItemMgr, getAdminMiscPriceMgr, getAdminModulesMgr, getAdminMultiStoreMgr, getAdminOrderMgr, getAdminPdfMgr, getAdminProdAttrMgr, getAdminProdMgr, getAdminPromMgr, getAdminReviewMgr, getAdminSearchRuleMgr, getAdminSecMgr, getAdminServletMgr, getAdminShipmentMgr, getAdminSolrMgr, getAdminStoreMgr, getAdminSuggestionMgr, getAdminTagMgr, getAdminTaxMgr, getAdminValidationMgr, getAdminVelocityContextMgr, getAdminWishListMgr, getBooleanFromString, getDebugStackTraceExclusions, getEmailThreadGracefulShutdownTimeout, getExportMgr, getExportMgr, getExportXMLData, getIntFromString, getKkAdminPropsFilePath, getKkConfig, getKkInstanceId, getMode, getModeString, getMqMgr, getNewCriteria, getNewCriteria, getNewCriteria, getNewCriteria, getOtherModuleByName, getPostSearchText, getPreSearchText, getProductsToCategoresCriteria, getPropertyValue, getPropertyValue, getPropertyValueAsBool, getPropertyValueAsInt, getPropertyValueAsLong, getRecordCount, getRecordCount, getRewardPointMgr, getSingleIntResult, getStoreId, getTemplate, getTemplateBase, getXml_io, init, insertKKEvent, insertKKEvent, isBusiness, isBusinessOrEnterprise, isCommunity, isConfigSet, isEnterprise, isMultiStoreLanguagesShared, isMultiStoreMode, isMultiStoreShareCategories, isMultiStoreShareCustomers, isMultiStoreShareCustomersOrProducts, isMultiStoreShareProducts, isMultiStoreSingleDBCSMode, isMultiStoreSingleDBMode, isMultiStoreSingleDBNonCSMode, isUnix, isWindows, manageException, manageThrowable, removeCData, sendMQMessages, setAdminEng, setDebugStackTraceExclusions, setKkAdminPropsFilePath, setupWildCardRules, setWildCardAfter, setWildCardBefore, shutdownGracefully, shutdownGracefully, timestampStr, updateStaticVariablesNow
protected static org.apache.commons.logging.Log log
protected java.lang.String storeOwner
protected java.lang.String storeName
protected java.lang.String storeUrl
protected java.lang.String storeOwnerEmailAddr
protected java.lang.String defaultBccEmails
protected java.lang.String logFileDirectory
protected java.lang.String pdfBase
protected java.lang.String imageBase
protected boolean debugEmail
protected boolean displayPricesWithTax
protected java.lang.String sysAdminEmailAddress
protected static final java.lang.String NEW_PASSWORD_TEMPLATE
protected static final java.lang.String ORDER_STATUS_CHANGE_TEMPLATE
protected static java.util.Map<java.lang.String,AdminEmailMgr.StaticData> staticDataHM
protected static java.lang.String emailMgrMutex
public AdminEmailMgr(KKAdminIf eng) throws java.lang.Exception
eng
- KKAdmin enginejava.lang.Exception
- an unexpected exceptionpublic void refreshConfigs() throws java.lang.Exception
refreshConfigs
in interface AdminEmailMgrIf
refreshConfigs
in class AdminBaseMgr
java.lang.Exception
- an unexpected exceptionprotected void refreshPrivateConfigs() throws java.lang.Exception
java.lang.Exception
- an unexpected exception@Deprecated public void sendNewPasswordEmail(java.lang.String emailAddr, java.lang.String newPassword, java.lang.String mailSubjectIn, java.lang.String countryCode) throws java.lang.Exception
sendNewPasswordEmail
in interface AdminEmailMgrIf
emailAddr
- Email address to send to - the TO: addressnewPassword
- the new password that was randomly generatedmailSubjectIn
- the email subject line. If null it is retrieved from the first line of the new
password template.countryCode
- country code (to pick the appropriate velocity template)java.lang.Exception
- an unexpected exceptionpublic void sendNewPasswordEmail1(java.lang.String emailAddr, java.lang.String newPassword, java.lang.String countryCode) throws java.lang.Exception
sendNewPasswordEmail1
in interface AdminEmailMgrIf
emailAddr
- Email address to send to - the TO: addressnewPassword
- the new password that was randomly generatedcountryCode
- country code (to pick the appropriate velocity template)java.lang.Exception
- an unexpected exceptionpublic boolean sendEmail(AdminEmail adminEmailData) throws KKAdminException
sendEmail
in interface AdminEmailMgrIf
adminEmailData
- the Email object to fill out to define the email to sendKKAdminException
- typically when the email could not be sentpublic void sendMail(int contentTypeIn, java.lang.String toAddressString, java.lang.String theSubject, java.lang.String theContent, boolean doBlindCopy, boolean async) throws KKAdminException
contentTypeIn
- the Content Type (Not set, Plain or HTML)toAddressString
- the TO: addresstheSubject
- the subject line of the emailtheContent
- the body of the emaildoBlindCopy
- if true the defined Blind Copy address will be addedasync
- set to true to send the mail asynchronously or false to send it synchronouslyKKAdminException
- an unexpected KKAdminException exceptionpublic void sendMail(int contentTypeIn, java.lang.String toAddressString, java.lang.String theSubject, java.lang.String theContent, boolean doBlindCopy, boolean async, AdminEmailOptions optionsIn) throws KKAdminException
contentTypeIn
- the Content Type (Not set, Plain or HTML)toAddressString
- the TO: addresstheSubject
- the subject line of the emailtheContent
- the body of the emaildoBlindCopy
- if true the defined Blind Copy address will be addedasync
- set to true to send the mail asynchronously or false to send it synchronouslyoptionsIn
- Email optionsKKAdminException
- an unexpected KKAdminException exceptionpublic void sendHTML(java.lang.String toAddressString, java.lang.String theSubject, java.lang.String theContentHTML, boolean doBlindCopy, java.lang.String bccEmails, boolean async) throws KKAdminException
sendHTML
in interface AdminEmailMgrIf
toAddressString
- the TO: addresstheSubject
- the subject line of the emailtheContentHTML
- the HTML body of the emaildoBlindCopy
- if true the defined Blind Copy address will be addedbccEmails
- Semicolon separated list of blind copy email addresses.async
- set to true to send the mail asynchronously or false to send it synchronouslyKKAdminException
- an unexpected KKAdminException exceptionpublic void sendHTML(java.lang.String toAddressString, java.lang.String theSubject, java.lang.String theContentHTML, boolean doBlindCopy, java.lang.String fullAttachmentFilename, java.lang.String friendlyAttachmentName, boolean deleteAttachmentAfterSend, java.lang.String bccEmails, boolean async) throws KKAdminException
toAddressString
- the TO: addresstheSubject
- the subject line of the emailtheContentHTML
- the HTML body of the emaildoBlindCopy
- if true the defined Blind Copy address will be addedfullAttachmentFilename
- full filename of the attachmentfriendlyAttachmentName
- friendly name to use for the attachmentbccEmails
- Semicolon separated list of blind copy email addresses.async
- set to true to send the mail asynchronously or false to send it synchronouslydeleteAttachmentAfterSend
- the deleteAttachmentAfterSendKKAdminException
- an unexpected KKAdminException exceptionpublic void sendHTML(AdminEmail adminEmailData, boolean async) throws KKAdminException
adminEmailData
- defines the emailasync
- set to true to send the mail asynchronously or false to send it synchronouslyKKAdminException
- an unexpected KKAdminException exceptionpublic void sendText(java.lang.String toAddressString, java.lang.String theSubject, java.lang.String theContentText, boolean doBlindCopy, java.lang.String bccEmails, boolean async) throws KKAdminException
sendText
in interface AdminEmailMgrIf
toAddressString
- the TO: addresstheSubject
- the subject line of the emailtheContentText
- the plain text body of the emaildoBlindCopy
- if true the defined Blind Copy address will be addedbccEmails
- Semicolon separated list of blind copy email addresses.async
- set to true to send the mail asynchronously or false to send it synchronouslyKKAdminException
- an unexpected KKAdminException exceptionpublic void sendText(java.lang.String toAddressString, java.lang.String fromAddressString, java.lang.String replyToAddressString, java.lang.String theSubject, java.lang.String theContentText, boolean doBlindCopy, java.lang.String bccEmails, boolean async) throws KKAdminException
sendText
in interface AdminEmailMgrIf
toAddressString
- TO: addressfromAddressString
- From addressreplyToAddressString
- reply to addresstheSubject
- the theSubjecttheContentText
- the plain text body of the emaildoBlindCopy
- if true the defined Blind Copy address will be addedbccEmails
- Semicolon separated list of blind copy email addresses.async
- set to true to send the mail asynchronously or false to send it synchronouslyKKAdminException
- an unexpected KKAdminException exceptionpublic void sendStatusChangeEmailForState(int orderId, int state) throws java.lang.Exception
sendStatusChangeEmailForState
in interface AdminEmailMgrIf
orderId
- the order Id of the order that has a changed statusstate
- the state of the orderjava.lang.Exception
- an unexpected exceptionpublic void sendStatusChangeEmailForState(AdminOrder order, int state) throws java.lang.Exception
sendStatusChangeEmailForState
in interface AdminEmailMgrIf
order
- the order that has a changed statusstate
- the state of the orderjava.lang.Exception
- an unexpected exceptionpublic void sendStatusChangeEmail(int orderId) throws java.lang.Exception
sendStatusChangeEmail
in interface AdminEmailMgrIf
orderId
- the order Id of the order whose status has a changed statusjava.lang.Exception
- an unexpected exceptionprotected void sendStatusChangeEmailPrivate(AdminOrder orderIn, int orderId, int state) throws java.lang.Exception
orderIn
- the order that has a changed statusorderId
- the order Id of the order whose status has a changed status. Only used if the
order is null.state
- the state of the orderjava.lang.Exception
- an unexpected exceptionpublic com.konakart.bl.Emailer getEmailer() throws KKAdminException
getEmailer
in interface AdminEmailMgrIf
KKAdminException
- an unexpected KKAdminException exceptionprotected com.konakart.bl.EmailConfig getConfigData() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionprotected javax.mail.Address getMailAddressFromString(java.lang.String addrString) throws KKAdminException
addrString
- the address in String formKKAdminException
- an unexpected KKAdminException exceptionpublic void sendTemplateEmail(AdminCustomer customer, java.lang.String templateName, java.lang.Object obj1, java.lang.Object obj2, java.lang.Object obj3, java.lang.Object obj4, java.lang.Object obj5, AdminEmailOptions optionsIn) throws java.lang.Exception
sendTemplateEmail
in interface AdminEmailMgrIf
customer
- The customer to which the eMail will be sent. It will be passed to the velocity
template with the name "cust".templateName
- The name of the template. The country code and .vm will be appended automatically.
i.e. If the template name is newsletter and the country code is en, then we will
look for a file called newsletter_en.vm.obj1
- This object will be passed to the velocity template with the name "obj1".obj2
- This object will be passed to the velocity template with the name "obj2".obj3
- This object will be passed to the velocity template with the name "obj3".obj4
- This object will be passed to the velocity template with the name "obj4".obj5
- This object will be passed to the velocity template with the name "obj5".optionsIn
- Email Optionsjava.lang.Exception
- an unexpected exceptionpublic void notifySysAdmin(java.lang.String message, AdminEmailOptions options) throws java.lang.Exception
AdminEmailMgrIf
Valid options are:
templateName
: The name of the template used to send the mail without the
country code and the .vm extension. e.g. If the name of the template is myTemplate and the
two letter country code is en, then KonaKart will search for a template called
myTemplate_en.vm .countryCode
: The two letter (lower case) country code used to search for the
template. e.g. en, de, es etc.customAttrs
: An array of name value pairs used to pass custom information to
the Velocity engine. The value can be retrieved from the template using the name preceded by
the $ sign. e.g. If a name value pair contains StoreId and 22, the value 22 will be displayed
in the eMail where the template contains $StoreId.fullAttachmentFilename
: The complete filename of an attachment.friendlyAttachmentName
: The friendly filename of an attachment that can be
viewed from the eMail.deleteAttachmentAfterSend
: When set to true
, the attachment is
deleted after being sent. The default value is false
.The Velocity context contains the following data:
customerName
: The name of the customer in the format firstName lastNamecustomer
: The CustomerIf objectmessage
: The message that may be used by the templatestoreOwner
: The name of the store owner.storeName
: The name of the store.storeOwnerEmailAddr
: The email address of the store owner.dateTool
: org.apache.velocity.tools.generic.DateTool object used to format
dates.locale
: java.util.Locale objectcurrencyMgr
: Used to format pricesnotifySysAdmin
in interface AdminEmailMgrIf
message
- The information within the message may be used by the template. Typically this
might be an exception message.options
- Options for the emailjava.lang.Exception
- an unexpected exceptionpublic void saveEmailContents(java.lang.String toAddr, int contentType, java.lang.String templateName, boolean doBCC, java.lang.String subject, java.lang.String body, java.lang.String addTofileName)
toAddr
- the toAddrcontentType
- the contentTypetemplateName
- the templateNamedoBCC
- the doBCCsubject
- the subjectbody
- the bodyaddTofileName
- the addTofileNameprivate boolean getAsyncFromSynchronousity(int synchcronousity, boolean def)
private java.lang.String getContentTypeStr(int contentType)
protected org.apache.velocity.app.VelocityEngine getVelocityEngine() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionpublic org.apache.velocity.VelocityContext getVelocityContext() throws java.lang.Exception
getVelocityContext
in interface AdminEmailMgrIf
java.lang.Exception
- an unexpected exceptionprotected boolean sendExternalMail(org.apache.velocity.VelocityContext context, java.lang.String konakartAPI, java.lang.String emailAddr, com.konakart.app.EmailTemplate emailTemplate, AdminEmailOptions options, AdminEmail adminEmailData)
context
- the contextkonakartAPI
- the konakartAPIemailAddr
- the emailAddremailTemplate
- the emailTemplateoptions
- the optionsadminEmailData
- the adminEmailDataprotected boolean isExternalMailEnabled(AdminEmailMgr.StaticData sd) throws com.konakart.app.KKException
sd
- the sdcom.konakart.app.KKException
- an unexpected KKException exceptionprotected void setInstalledExternalMailModule(AdminEmailMgr.StaticData sd) throws java.lang.Exception
sd
- the sdjava.lang.Exception
- an unexpected exceptionCopyright © 2018 DS Data Systems UK Ltd.