• Welcome to KonaKart Community Forum. Please login or sign up.
 

Send an email when a new coupon is added

Started by vicent, September 26, 2011, 05:05:53 pm

Previous topic - Next topic

vicent

Hello. Anyone knows if there is a way to send an email when a coupon is added for a customer?
Is it possilble to do it by configuration? if not. which is the best way to do it?

thanks.


julie

What do you mean by "coupon added for a customer" ?

vicent

Well I done it by code. I have 2 promotions, one is invite a friend and other is birthday, both promotions generates a coupon when a customer acomplishes the requeriments. Of course, the customer should receive notification by email. I do it by code but my question is if there is some configuration in konakart that makes it automaticaly, providing a template for each promotion. If not, I think it might be a good improvement. And most if shops owner wants to make more promotions without adding code.

julie

I'm still not sure about what process you use to generate the coupon, but anyway we do have an API call to send a template based eMail:

    /**
     * This method is used to send a template based eMail to a customer identified by the
     * customerId.
     * <p>
     * Valid options are:
     * <ul>
     * <li><code>templateName</code>: 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 .</li>
     * <li><code>countryCode</code>: The two letter (lower case) country code used to search for the
     * template. e.g. en, de, es etc.</li>
     * <li><code>customAttrs</code>: 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.</li>
     * <li><code>fullAttachmentFilename</code>: The complete filename of an attachment.</li>
     * <li><code>friendlyAttachmentName</code>: The friendly filename of an attachment that can be
     * viewed from the eMail.</li>
     * <li><code>deleteAttachmentAfterSend</code>: When set to <code>true</code>, the attachment is
     * deleted after being sent. The default value is <code>false</code>.</li>
     * </ul>
     * <p>
     * The Velocity context contains the following data:
     * <ul>
     * <li><code>customerName</code>: The name of the customer in the format firstName lastName</li>
     * <li><code>customer</code>: The CustomerIf object</li>
     * <li><code>message</code>: The message that may be used by the template</li>
     * <li><code>storeOwner</code>: The name of the store owner.</li>
     * <li><code>storeName</code>: The name of the store.</li>
     * <li><code>storeOwnerEmailAddr</code>: The email address of the store owner.</li>
     * <li><code>dateTool</code>: org.apache.velocity.tools.generic.DateTool object used to format
     * dates.</li>
     * <li><code>locale</code>: java.util.Locale object</li>
     * <li><code>currencyMgr</code>: Used to format prices</li>
     * </ul>
     *
     * @param customerId
     *            The numeric id of the customer
     * @param message
     *            The information within the message may be used by the template.
     * @param options
     *            Options for the email
     * @return Returns an Email object containing the content of the email
     * @throws KKException
     */
    public EmailIf sendTemplateEmailToCustomer1(int customerId, String message,
            EmailOptionsIf options) throws KKException;