Mail Manager
Copyright © 2001, William Weiland
Overview
Send specialized emails at the completion of the order. These emails are in addition to the standard emails which are sent at order completion.

Email to a drop-ship manufacturer listing the Ship To address and the products to be shipped.

Email to Ship To or Bill To or both thanking them for a donation to your sponsored charity on your site.

Email to your shipping department listing Ship To address and products ordered. Products section can be torn/folded to result in a shipping label with your company address included.

Email a promo coupon code if a customer purchases a specific product or from a list of products


Initial Setup
Use the Merchant admin upload feature (admin:modules:add module) to upload the mailman.mvc module (mailman.mv for uncompiled Merchant). Once uploaded, click the Add button to add it to the mall/domain.

In admin, under your store, click on the link for Order Fulfillment Configuration. Assign the module and Update it to install it in your store.

Click the link for Mail Manager to begin template creation.

In compiled Merchant, the report module (mailmanr.mvc) can be uploaded and added to the domain. Then install it as a store utility module under admin:storename:utilities.


Template Creation
Determine what you are going to use this module for, then create template emails to fulfill those needs. Click on the Add new image to open a new record.

Title
Create a unique identity for each template that is somewhat descriptive. This title will also be the subject line in the template emails.

From Email
This is the email address that the template will be sent from. You should expect that this will be the email address that recipients will reply to.

Email To
You can choose one or more of the three options for sending the email to. If you check the box for Ship To or Bill To, the module will read those variables from the order and insert the email address accordingly. You can also fill in a static email address. For example, if the template is being sent to a drop ship manufacturer, there may be a specific address you are required to use. If you choose to use more than one of the addresses, one will be the "to" and the others will be the "cc".

Applicable Product Codes
The email will be generated if one of the product codes listed in the box also appears in the order. Insert the eligible codes in the input with each code terminated with the ^ character. For example:
ABC123^
XYZ123^
Alternatively, you can use the asterisk (*) as the only character in the input as a wildcard and it will cause any product ordered to generate the email. In the compiled version of the module, you can further specify the product code and one attribute/option value. For example:
ABC123|Version|4^
XYZ123|Size|M^
EXTERNAL|Vendor|Acme^

Horizontal and Vertical Templates

The email is built by filling in text area inputs and checking applicable inclusion boxes for the content you wish to have in the email.

From Address
Enter the full physical address for your store if you want the address to appear in the template you are adding/editing.

To Address
Enter the full physical address for your recipient if you want it to appear in the template you are adding/editing. This would most likely be used when the template is a recurring email, eg to a manufacturer for drop shipping.

Salutation
You can use the Ship To or Bill To first and last name from the order or you can enter a static salutation. If you leave the select as Other, then leave the text box blank, there will be no salutation in this particular template.

Email Body
You can compose a message which will be included within the email body. If you leave this input blank, no message text will be included in this template.

Layout/Orientation
Choose how you want the data to be laid out in the email, either horizontally or vertically. Some don't like horizontal orientation because of its tendancy to line wrap with long product names, making it difficult to read.

Ship To Address
If you mark this check box the ship to address from the order will appear in the email. If you mark it as a label, it will be offset to the right so that it can be used in an address label slip.

Bill To Address
If you mark this check box the bill to address from the order will appear in the email.

Products
If checked, this will display the products listed in the products text box (or all if the wildcard is used) which were also in the order. There may be products in the order which will not display if they were not in the products text box to the right (above if using the compiled version of the module). As an example, you may have several drop ship emails go out with a single order because the products are being shipped from different manufacturers or distribution points. Hence, each email would only contain the products relevent to the distribution point addressee.

Prices
If this is checked, the prices of the above products will be included. Normally the prices will NOT be displayed when only a partial listing of products in the order are displayed. This is because the individual prices would not add up to the order tax, shipping and total (which is derived from all products).

You would most likely hide the prices when the email is sent to a manufacturer for drop shipping. What you charge for the products is normally not their business nor concern.

Free Form Template (compiled version only)

With the compiled version of Merchant (4.14 and newer) you can create a template by including text and using tokens to insert variable values within the email body at locations of your chosing. Tokens are only available in the free form template layout. They are not available in the horizontal and vertical layouts above.

Typical Merchant Notification Email
The typical Merchant notification email contains ship to and bill to info along with the products and payment information.

Tokens and Mini-scripts Available
Several tokens and mini-scripts can be used to build the email.

Sample Inputs for Notification Emails
An example of the inputs for the merchant notification and customer confirmation emails can be used to quickly build templates. These txt files should display the html code on the screen, but IE users may see the page converted to html. If that is the case, you will need to view the page source to see the code to use in the templates.

Sample Inputs for Brief Output
An example of the inputs for a brief email which may be useful for cell phone notification emails. This particular example displays the order number and total along with a list of products.

Sample Inputs for Label
An example of the inputs for a label email which may be printed. This particular example displays the order number and a label with the "ship to" address automatically formatted to the postal recommendations of the "ship to" country.

Other Uses

The Mail Manager can be used for events other than notification emails when an order is completed.

Welcome Email
In the Applicable Product Codes box you can enter product codes or the asterisk as discussed above. However, this box serves a secondary purpose. If you enter a # sign in the box as the first character, an entirely different process is run. Mail Manager will evaluate the number following the # and link it with an external module using the specific ID. Built into the system is ID #1 This is used to generate a Welcome Message from a log module action. If you have installed our log module, included the ID of #1 in the Applicable Product Codes box, filled out the From email address, the email body (main section in the template layout), and Title (e.g. Welcome to), the Mail Manager will create a welcome email at the time a customer creates a new account. If you want to include tokens in the welcome email, you'll need to use the template layout, not horizontal or vertical.

You need to evaluate this feature on your own server as we have found that in some cases the secure server is processing the email way too slow and it brings down the registration process. Each server handles mail sending differently so we expect in some cases you will be able to use this bonus feature and some you will not. If yours cannot, simply don't create a template with a #1 ID. As for the cim_log.mvc (cim_log.mv uncompiled) file, it is used with several of our modules to perform certain tasks. If it is required for those other modules, then you will still install it as a Logging module. If it is not needed for any of our other modules (each module states if cim_log.mvc (cim_log.mv uncompiled) is needed) and you don't want to use the Welcome Email feature, then you don't need to install it.

Product Rating
As with the Welcome Email above, you can create a thank you for rating a product type of email. Our Rate This module already has built in a link to use ID #32. Therefore, if you create a template with the Applicable Product Code of #32, that template will run whenever a customer rates one of your products.

Resending Order Emails (requires OpenUI or template page system)
You can have a form in your store that lets the customer re-send themselves the order email. This should be on the secure account page to limit access to it. It requires the customer know the order number and email address used for the order. Below is an example of the form and the token to be inserted on the Customer Edit page. Change the domain url and store code before using this.
%module|mailman|resend%
<CENTER>
<table border="0">
<form method="post" action="https://www.yourdomain.com/Merchant2/merchant.mvc">
<tr>
<td align="right">
<font face="Arial, Helvetica" size="2">
Order Number: </td>
<td>
<font face="Arial, Helvetica" size="2">
<input type="text" name="resend_order" value="" size="6">
</font>
</td>
</tr>
<tr>
<td align="right">
<font face="Arial, Helvetica" size="2">
Order Email Address:
</font>
</td>
<td>
<font face="Arial, Helvetica" size="2">
<input type="text" name="resend_email" value="" size="20">
</font>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" name="nul_button" value="Resend Order Email">
<input type="hidden" name="Screen" value="ACNT">
<input type="hidden" name="Order" value="0">
<input type="hidden" name="Store_Code" value="yourstorecode">
</td>
</tr>
</table>
</form>
</CENTER>

A word of caution, when the email is sent you need to have text to distinguish it from a new order email, otherwise you might send out the products again. Only use the resend feature if your emails are the template layout. Put the following in the main body of the email:
%ifvar|resend_order|<h3>Order Email Resent: *resend_order*</h3>%
Test it out and see if it is prominently displayed.

Other Auto-responses
As with the Welcome Email above, you can create auto-responses for just about any action in your store. The only requirements are:
1) you create a template with a unique ID in the Applicable Product Codes box, e.g. #21,
2) you insert the calling line
<MvDO FILE = "{g.Module_Root $ 'modules/fulfill/mailman.mv'}" NAME = "l.welcome" VALUE = "{Send_Response(your_unique_number_here)}">
at the point you want it to occur (note the file name is mailman.mvc if compiled),
3) the customer is logged in so that their email address is available to the Mail Manager. In step 2, only put the number in the function, not the # sign. In the Applicable Product Codes box, you put both, e.g. #21

If you have compiled Merchant (4.14 and newer) and you have the OpenUI, you can use a module token in any area where OpenUI tokens can be used. These can be put on just about any screen in your store.
1) you create a mail manager template with a unique ID in the Applicable Product Codes box, e.g. #21,
2) you insert the calling token
%module|mailman|spawn~the number~the optional email variable%
at the point/screen you want it to occur,
Only put the number in the token's 2nd parameter, not the # sign. In the Applicable Product Codes box, you put both, e.g. #21
3) the customer is logged in so that their email address is available to the Mail Manager. Alternatively, the 3rd parameter in the token in step 2 can be an email address. You can use a variable or hard code an email address.

With Merchant 4.14 and newer and using OpenUI, here's an example of a token on the product page to send a specific email on a product page. The email is going to the customer's bill to email address. If you leave it blank, it will go to their password recovery address. If you want it sent to a hard coded address, e.g. yours to monitor traffic, you would put your email address in the 3rd parameter. The email used is 21 which corresponds to the template you have identified in the Applicable Product Codes input as #21. You can have an unlimited number of email templates.
%module|mailman|spawn~21~Customers.d.bill_email%
You would want to surround this with OpenUI tokens to determine if the customer was logged in and the product page showing was for the product you were running it for.