Tell A Friend Mail Generator
Copyright © 1999, William Weiland
Overview
Provide an easy interface for visitors to refer your site URL to their friends. It uses the Miva SMTP capability. The subject and body of the Tell a Friend message is configurable through the Merchant admin interface. If the customer sends this email when they are on a specific product screen, a second link to the product is included in the email. Also configurable is the customer screen and optional log and store emails.
Initial Setup
Unzip the mailgen.zip file. Use the Merchant admin upload feature to upload the mailgen.mv(c) module. Once uploaded, click the Add button to add it to the mall/domain.

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

Click the link for Mail Generator to enter the configuration settings.

The compiled version of this module licensed on or after November 7, 2003 has a new file called cim_new.mvc which you need to install. Install through admin as a store system extension module.


Configuration Settings
Enter data into the applicable input fields.

Subject
Enter the text you want for the subject of the email that is sent.

Letter Body
Enter the body of the letter, including your store URL you want them to have as a link.

Store Email (Optional)
Include an email address only if you want to get an email whenever someone sends a Tell-A-Friend email.

Form Button
Enter the text you want for the text of the button for Tell-A-Friend.

Form Button Image (Optional)
If you want to use a graphic for a button, enter the path, e.g. graphics/tell.gif

Form Button Location
Choose from among the eight possible locations on the screen to put the button. In addition to the eight locations, you can combine the mid product screen location with the nav bar or category column location.

Screen Title
Enter the text you want for the title at the top of the screen.

Font Size, Face, Color
Enter the settings you want for the FONT tag.

Table Background
Enter the color you want for the form the customer sees when entering the Tell-A-Friend email info.

Flat File Log
You can create a flat file log of each Tell-A-Friend entry. It includes the date, from email, to email and the product code if it was sent from a specific product screen. The flat file is stored in the store data directory under a subdirectory called mailgen. The file name is mailgen.dat, e.g. Merchant2/00000001/mailgen/mailgen.dat You can periodically retrieve the file for analysis or crediting those customers who refer people to your site. It can be deleted and it will start anew with the next Tell-A-Friend entry.

Templates
In the compiled version of the module you can add tokens to the email. You can also use an alternate friend entry form which is a template that you can customize. View a sample of each of these templates.


Editing Requirements (skip if using the OpenUI)
If you are using the Miva Merchant User Interface (mmui) you will need to make some very simple edits to the core files. Be sure to do that with a text editor (NO WYSIWYG editors) such as Programmer's File Editor (PFE) so as not to damage the mv files. ALWAYS BACKUP your unmodified mv files in case you make a mistake.

1) Skip this paragraph if using compiled Merchant and you licensed this module after Nov 7, 2003. Locate the function UIModule_Dispatch in the mmui.mv file. Include the following code in the latter half of the function, not near the beginning of the UIModule_Dispatch function.
<MvIF EXPR = "{ g.Screen EQ 'TELL' }">
<MvDO FILE="{g.Module_Root$'modules/util/mailgen.mv'}" NAME = "l.showtellbutton" VALUE = "{MailGen_Open_Store()}">
<MvIF EXPR = "{g.Action}">
<MvDO FILE="{g.Module_Root$'modules/util/mailgen.mv'}" NAME="l.ok" VALUE="{TellFriend()}">
<MvASSIGN NAME = "l.ok" VALUE = "{ MMUI_StoreFront() }">
<MvELSE>
<MvASSIGN NAME="l.ok" VALUE="{MMUI_Begin_Screen(Stores.d.name $ ': ' $ MailGen.d.screenhdr, 0, 0 )}">
<MvDO FILE="{g.Module_Root$'modules/util/mailgen.mv'}" NAME="l.ok" VALUE="{TellFriend()}">
</TD></TR></TABLE>
<MvFUNCTIONRETURN VALUE = "{ MMUI_Close_Store() }">
</MvIF>
</MvIF>

2) Skip this paragraph if using compiled Merchant and you licensed this module after Nov 7, 2003. If you want to display the Tell a Friend button below the category list, you could include the following just before the last </TABLE> tag in the mmui.mv file's MMUI_Begin_Screen function.
<MvDO FILE="{g.Module_Root$'modules/util/mailgen.mv'}" NAME = "l.showtellbutton" VALUE = "{MailGen_Open_Store()}">
<FORM METHOD = "post" ACTION = "&[ g.sessionurl ]">
<TR><TD>
<INPUT TYPE = "hidden" NAME = "Store_Code" VALUE = "&[ Stores.d.code:entities ]">
<INPUT TYPE = "hidden" NAME = "Screen" VALUE = "TELL">
<MvIF EXPR = "{(g.Screen EQ 'PROD') AND len(g.Product_Code)}">
<INPUT TYPE = "hidden" NAME = "Old_Screen" VALUE = "PROD">
<INPUT TYPE = "hidden" NAME = "Product_Code" VALUE = "&[g.Product_Code:entities];">
</MvIF>
<MvIF EXPR = "{len(MailGen.d.promptbtni)}">
<INPUT TYPE = "image" ALT = "&[MailGen.d.promptbtn:entities]" SRC = "&[MailGen.d.promptbtni:entities]" BORDER = 0>
<MvELSE>
<INPUT TYPE = "submit" NAME = "TellEm" VALUE = "&[MailGen.d.promptbtn:entities]">
</MvIF>
</TD></TR>
</FORM>

3) Use this paragraph if using compiled Merchant and you licensed this module after Nov 7, 2003. You can display this form in any screen header or footer. Fill in the info for your domain. No editing of the mmui.mv is required.
<FORM METHOD = "post" ACTION = "your full merchant.mvc url">
<TR><TD>
<INPUT TYPE = "hidden" NAME = "Store_Code" VALUE = "your store code">
<INPUT TYPE = "hidden" NAME = "Screen" VALUE = "NEW">
<INPUT TYPE = "hidden" NAME = "SubScreen" VALUE = "TELL">
<INPUT TYPE = "image" ALT = "Tell A Friend" SRC = "path to your image" BORDER = 0>
</TD></TR>
</FORM>


Upgrade Note
If you are upgrading from a previous version of this module to the compiled version, this paragraph may apply to you. The compiled version of this module licensed on or after November 7, 2003 has a new link for calling the customer entry screen. So if you have a button or link on a static page to call the customer entry screen, you will need to change the Screen to NEW and include SubScreen=TELL. You will also be installing a new file called cim_new.mvc.