com.konakart.bl
Class EmailMgr

java.lang.Object
  extended by com.konakart.bl.BaseMgr
      extended by com.konakart.bl.EmailMgr
All Implemented Interfaces:
EmailMgrIf

public class EmailMgr
extends BaseMgr
implements EmailMgrIf

Email Manager class.


Field Summary
protected  java.lang.String imageBase
           
protected static org.apache.commons.logging.Log log
          the log
protected  java.lang.String logFileDirectory
           
static java.lang.String LOW_STOCK_ALERT_TEMPLATE
          Name of template for sending the Low Stock Alert eMail
static java.lang.String NEW_PASSWORD_TEMPLATE
          Name of template for sending the new password eMail
static java.lang.String ORDER_CONFIRMATION_TEMPLATE
          Name of template for sending the Order Confirmation eMail
protected  java.lang.String pdfBase
           
protected  boolean sendEmails
           
protected  boolean sendNewPasswordEmails
           
protected  boolean sendOrderConfEmails
           
protected  boolean sendStockReordeEmails
           
protected  boolean sendWelcomeEmails
           
protected  java.lang.String storeName
           
protected  java.lang.String storeOwner
           
protected  java.lang.String storeOwnerEmailAddr
           
static java.lang.String WELCOME_TEMPLATE
          Name of template for sending the Welcome eMail
 
Fields inherited from class com.konakart.bl.BaseMgr
templateBaseDir
 
Constructor Summary
EmailMgr(KKEngIf eng)
          Constructor
 
Method Summary
 Emailer getEmailer()
          Used to get a new Emailer object used to send the E mails
protected  VelocityContextMgrIf getVelocityContextMgr()
           
protected  org.apache.velocity.app.VelocityEngine getVelocityEngine()
           
 boolean isEmailValid(java.lang.String emailAddr)
          Determines whether the eMail address is valid
protected  void putCommonDataInContext(org.apache.velocity.VelocityContext context, java.lang.String countryCode)
          Common data that is placed in the context
protected  void putCustomAttrsInContext(org.apache.velocity.VelocityContext context, NameValueIf[] customAttrs)
          protected method used to populate the Velocity context with custom attributes
 void refreshConfigs()
          Setup variables needed to send the mail
 void sendHTML(java.lang.String toAddressString, java.lang.String theSubject, java.lang.String theContentHTML, boolean doBlindCopy, 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, boolean async)
          Send a HTML-only email message to the specified recipient, with the specified subject and HTML content.
 void sendNewPasswordEmail(java.lang.String emailAddr, java.lang.String newPassword, java.lang.String mailSubject, java.lang.String countryCode)
          Deprecated.  
 EmailIf sendNewPasswordEmail1(java.lang.String emailAddr, java.lang.String newPassword, Customer cust, EmailOptionsIf options)
          Sends a new password to user who has forgotten password.
 void sendOrderConfirmationEmail(java.lang.String sessionId, int orderId, java.lang.String mailSubject, int languageId)
          Deprecated.  
 EmailIf sendOrderConfirmationEmail1(java.lang.String sessionId, int orderId, int langIdForOrder, EmailOptionsIf options)
          An order confirmation email is sent after submitting an order.
 void sendStockReorderEmail(java.lang.String emailAddr, java.lang.String productName, int productQuantity, int productId, java.lang.String sku)
          Send an email to warn that a product stock level has fallen below a pre defined level
 void sendTemplateEmailToCustomer(int customerId, java.lang.String templateName, java.lang.String message, java.lang.String countryCode)
          Deprecated.  
 EmailIf sendTemplateEmailToCustomer1(int customerId, java.lang.String message, EmailOptionsIf options)
          Used to send a template based email to a customer
 void sendText(java.lang.String toAddressString, java.lang.String theSubject, java.lang.String theContentText, boolean doBlindCopy, boolean async)
          Send a text-only email message to the specified recipient, with the specified subject and text content.
 void sendWelcomeEmail(int customerId, java.lang.String mailSubject, java.lang.String countryCode)
          Deprecated.  
 EmailIf sendWelcomeEmail1(int customerId, EmailOptionsIf options)
          A welcome email is sent after registration
protected  void validateEmailOptions(EmailOptionsIf options)
          protected method used to validate the eMail options
 
Methods inherited from class com.konakart.bl.BaseMgr
addInsertAttr, addInsertAttr, checkRequired, executeQuery, executeQuery, getAdminEngMgr, getBasketMgr, getBillingMgr, getBookableProductMgr, getCatMgr, getConfigMgr, getCookieMgr, getCurrMgr, getCustMgr, getCustomerIdFromSession, getCustomerStatsMgr, getCustomerTagMgr, getEmailMgr, getEng, getLangMgr, getManuMgr, getMiscItemMgr, getMode, getModeString, getMqMgr, getMultiStoreMgr, getNewCriteria, getNewCriteria, getOrderIntegrationMgr, getOrderMgr, getOrderTotalMgr, getPaymentMgr, getProdMgr, getPromMgr, getPunchOutMgr, getRewardPointMgr, getSecMgr, getShippingMgr, getSolrMgr, getStoreId, getTaxMgr, getTemplate, getTemplateRoot, getWishListMgr, init, isDeadlockException, isEnterprise, isMultiStoreShareCategories, isMultiStoreShareCustomers, isMultiStoreShareProducts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
the log


storeOwner

protected java.lang.String storeOwner

storeName

protected java.lang.String storeName

storeOwnerEmailAddr

protected java.lang.String storeOwnerEmailAddr

sendEmails

protected boolean sendEmails

sendOrderConfEmails

protected boolean sendOrderConfEmails

sendStockReordeEmails

protected boolean sendStockReordeEmails

sendWelcomeEmails

protected boolean sendWelcomeEmails

sendNewPasswordEmails

protected boolean sendNewPasswordEmails

logFileDirectory

protected java.lang.String logFileDirectory

pdfBase

protected java.lang.String pdfBase

imageBase

protected java.lang.String imageBase

NEW_PASSWORD_TEMPLATE

public static final java.lang.String NEW_PASSWORD_TEMPLATE
Name of template for sending the new password eMail

See Also:
Constant Field Values

WELCOME_TEMPLATE

public static final java.lang.String WELCOME_TEMPLATE
Name of template for sending the Welcome eMail

See Also:
Constant Field Values

ORDER_CONFIRMATION_TEMPLATE

public static final java.lang.String ORDER_CONFIRMATION_TEMPLATE
Name of template for sending the Order Confirmation eMail

See Also:
Constant Field Values

LOW_STOCK_ALERT_TEMPLATE

public static final java.lang.String LOW_STOCK_ALERT_TEMPLATE
Name of template for sending the Low Stock Alert eMail

See Also:
Constant Field Values
Constructor Detail

EmailMgr

public EmailMgr(KKEngIf eng)
         throws java.lang.Exception
Constructor

Parameters:
eng -
Throws:
java.lang.Exception
Method Detail

refreshConfigs

public void refreshConfigs()
                    throws java.lang.Exception
Setup variables needed to send the mail

Specified by:
refreshConfigs in interface EmailMgrIf
Throws:
java.lang.Exception

sendHTML

public void sendHTML(java.lang.String toAddressString,
                     java.lang.String theSubject,
                     java.lang.String theContentHTML,
                     boolean doBlindCopy,
                     boolean async)
              throws KKException
Send a HTML-only email message to the specified recipient, with the specified subject and HTML content.

Specified by:
sendHTML in interface EmailMgrIf
Parameters:
toAddressString - TO: address
theSubject - the subject line
theContentHTML - the HTML body of the email
doBlindCopy - if true add the defined Blind Copy address, if false do not.
async - set to true to send the mail asynchronously or false to send it synchronously
Throws:
KKException

sendHTML

public 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,
                     boolean async)
              throws KKException
Send a HTML-only email message to the specified recipient, with the specified subject and HTML content.

Parameters:
toAddressString - TO: address
theSubject - the subject line
theContentHTML - the HTML body of the email
doBlindCopy - if true add the defined Blind Copy address, if false do not.
fullAttachmentFilename - full filename of the attachment
friendlyAttachmentName - friendly name to use for the attachment
deleteAttachmentAfterSend - set to true to delete the attachment file after the send
async - set to true to send the mail asynchronously or false to send it synchronously
Throws:
KKException

sendText

public void sendText(java.lang.String toAddressString,
                     java.lang.String theSubject,
                     java.lang.String theContentText,
                     boolean doBlindCopy,
                     boolean async)
              throws KKException
Send a text-only email message to the specified recipient, with the specified subject and text content.

Specified by:
sendText in interface EmailMgrIf
Parameters:
toAddressString - TO: address
theSubject - the subject line
theContentText - the plain text body of the mail
doBlindCopy - if true add the defined Blind Copy address, if false do not.
async - set to true to send the mail asynchronously or false to send it synchronously
Throws:
KKException

isEmailValid

public boolean isEmailValid(java.lang.String emailAddr)
Determines whether the eMail address is valid

Specified by:
isEmailValid in interface EmailMgrIf
Parameters:
emailAddr -
Returns:
Returns true if the email address is valid. Otherwise returns false.

getVelocityEngine

protected org.apache.velocity.app.VelocityEngine getVelocityEngine()
                                                            throws java.lang.Exception
Returns:
Returns a VelocityEngine
Throws:
java.lang.Exception

getVelocityContextMgr

protected VelocityContextMgrIf getVelocityContextMgr()
                                              throws java.lang.Exception
Overrides:
getVelocityContextMgr in class BaseMgr
Throws:
java.lang.Exception

sendNewPasswordEmail

@Deprecated
public void sendNewPasswordEmail(java.lang.String emailAddr,
                                            java.lang.String newPassword,
                                            java.lang.String mailSubject,
                                            java.lang.String countryCode)
                          throws java.lang.Exception
Deprecated. 

Description copied from interface: EmailMgrIf
Please use sendNewPasswordEmail1()

Specified by:
sendNewPasswordEmail in interface EmailMgrIf
Parameters:
emailAddr -
newPassword -
mailSubject -
countryCode -
Throws:
java.lang.Exception

sendNewPasswordEmail1

public EmailIf sendNewPasswordEmail1(java.lang.String emailAddr,
                                     java.lang.String newPassword,
                                     Customer cust,
                                     EmailOptionsIf options)
                              throws java.lang.Exception
Sends a new password to user who has forgotten password.

Specified by:
sendNewPasswordEmail1 in interface EmailMgrIf
Parameters:
emailAddr -
newPassword -
options -
Returns:
Returns an EmailIf object
Throws:
java.lang.Exception

sendStockReorderEmail

public void sendStockReorderEmail(java.lang.String emailAddr,
                                  java.lang.String productName,
                                  int productQuantity,
                                  int productId,
                                  java.lang.String sku)
                           throws java.lang.Exception
Send an email to warn that a product stock level has fallen below a pre defined level

Specified by:
sendStockReorderEmail in interface EmailMgrIf
Parameters:
emailAddr -
productName -
productQuantity -
productId -
sku -
Throws:
java.lang.Exception

sendWelcomeEmail

@Deprecated
public void sendWelcomeEmail(int customerId,
                                        java.lang.String mailSubject,
                                        java.lang.String countryCode)
                      throws java.lang.Exception
Deprecated. 

A welcome email is sent after registration

Specified by:
sendWelcomeEmail in interface EmailMgrIf
Parameters:
customerId -
mailSubject -
countryCode -
Throws:
java.lang.Exception

sendWelcomeEmail1

public EmailIf sendWelcomeEmail1(int customerId,
                                 EmailOptionsIf options)
                          throws java.lang.Exception
A welcome email is sent after registration

Specified by:
sendWelcomeEmail1 in interface EmailMgrIf
Parameters:
customerId -
options -
Returns:
Returns an Email object
Throws:
java.lang.Exception

sendOrderConfirmationEmail

@Deprecated
public void sendOrderConfirmationEmail(java.lang.String sessionId,
                                                  int orderId,
                                                  java.lang.String mailSubject,
                                                  int languageId)
                                throws java.lang.Exception
Deprecated. 

An order confirmation email is sent after submitting an order.

Specified by:
sendOrderConfirmationEmail in interface EmailMgrIf
Parameters:
sessionId -
orderId -
mailSubject -
languageId -
Throws:
java.lang.Exception

sendOrderConfirmationEmail1

public EmailIf sendOrderConfirmationEmail1(java.lang.String sessionId,
                                           int orderId,
                                           int langIdForOrder,
                                           EmailOptionsIf options)
                                    throws java.lang.Exception
An order confirmation email is sent after submitting an order.

Specified by:
sendOrderConfirmationEmail1 in interface EmailMgrIf
Parameters:
sessionId -
orderId -
langIdForOrder -
options -
Returns:
Returns an Email object
Throws:
java.lang.Exception

sendTemplateEmailToCustomer

@Deprecated
public void sendTemplateEmailToCustomer(int customerId,
                                                   java.lang.String templateName,
                                                   java.lang.String message,
                                                   java.lang.String countryCode)
                                 throws java.lang.Exception
Deprecated. 

Used to send a template based email to a customer

Specified by:
sendTemplateEmailToCustomer in interface EmailMgrIf
Parameters:
customerId -
templateName -
message -
countryCode -
Throws:
java.lang.Exception

sendTemplateEmailToCustomer1

public EmailIf sendTemplateEmailToCustomer1(int customerId,
                                            java.lang.String message,
                                            EmailOptionsIf options)
                                     throws java.lang.Exception
Used to send a template based email to a customer

Specified by:
sendTemplateEmailToCustomer1 in interface EmailMgrIf
Parameters:
customerId -
message -
options -
Returns:
Returns an Email object
Throws:
java.lang.Exception

getEmailer

public Emailer getEmailer()
                   throws KKException
Description copied from interface: EmailMgrIf
Used to get a new Emailer object used to send the E mails

Specified by:
getEmailer in interface EmailMgrIf
Returns:
Returns a new Emailer.
Throws:
KKException

validateEmailOptions

protected void validateEmailOptions(EmailOptionsIf options)
                             throws KKException
protected method used to validate the eMail options

Parameters:
options -
Throws:
KKException

putCustomAttrsInContext

protected void putCustomAttrsInContext(org.apache.velocity.VelocityContext context,
                                       NameValueIf[] customAttrs)
protected method used to populate the Velocity context with custom attributes

Parameters:
context -
customAttrs -

putCommonDataInContext

protected void putCommonDataInContext(org.apache.velocity.VelocityContext context,
                                      java.lang.String countryCode)
                               throws java.lang.Exception
Common data that is placed in the context

Parameters:
context -
countryCode -
Throws:
java.lang.Exception


Copyright © 2011 DS Data Systems UK Ltd.