Tokens for the Subject/Title of the email

%order_id%
%order_total%
%order_total_f%
%order_bill_fname%
%order_bill_lname%
%order_ship_fname%
%order_ship_lname%
%order_bill_email%
%order_ship_email%
%order_shipping_total_f% (Merchant 5.x - legacy template only)

Tokens for the From header of the email

%order_bill_email%
%order_ship_email%
%store_email%
These additional from address tokens were added in Mail Manager v5.088. Those with _name will add the name at the beginning of the from address. To use the _name tokens you will need to have "Add Angle Brackets to Email Addresses" turned on in your global settings:domain settings:site configuration if your mail server supports them. The mail server also has to support the name inclusion. If you find the email is not sending with them, then roll back to just the email address and see if that fixes it. If your mail server does not support it, it is likely due to strict application of the "from" address rules.
%store_email_name%
%order_bill_email_name%
%order_ship_email_name%
In Mail Manager 5.091 we added some additional name tokens. If the above don't work, try these. We found these were needed on the new mivamerchant.com servers.
%store_email_namens%
%order_bill_email_namens%
%order_ship_email_namens%

Tokens and scripts for the "Main Section" input of the template layout email

%order_id%
%order_total%
%order_total_f%
%order_date%
%order_time%
%order_date_yyyymmdd%
%order_date_yyyy%
%order_date_mm%
%order_date_dd%
%order_time_hh%
%order_time_mm%
%order_time_ss%
%order_ship_fname%
%order_ship_lname%
%order_ship_email%
%order_ship_phone%
%order_ship_address%
%order_ship_address1% (core 18 wombat)
%order_ship_address2% (core 18 wombat)
%order_ship_city%
%order_ship_state%
%order_ship_zip%
%order_ship_company%
%order_bill_fname%
%order_bill_lname%
%order_bill_email%
%order_bill_phone%
%order_bill_address%
%order_bill_address1% (core 18 wombat)
%order_bill_address2% (core 18 wombat)
%order_bill_city%
%order_bill_state%
%order_bill_zip%
%order_bill_company%
%ship_country%
%bill_country%
%ship_country_long%
%bill_country_long%
%ship_block% (full address formatted per each country's postal regulations)
%bill_block% (full address formatted per each country's postal regulations)

%list_products%
%product_code%
%product_name%
%product_quantity%
%product_price%
%product_price_f%
%product_extended_price%
%product_extended_price_f%
%product_descrip%
%product_weight% (Merchant 5.x)
%product_extended_weight% (Merchant 5.x)
%product_thumbnail% (Merchant 5.x - see below if using 4.x)
%product_image% (Merchant 5.x - see below if using 4.x)
%product_price_sum% (Merchant 4.14 and newer - product base + attribute prices)
%product_extended_price_sum% (Merchant 4.14 and newer - product base + attribute prices X quantity)
%product_price_sum_f% (Merchant 4.14 and newer - formatted product base + attribute prices)
%product_extended_price_sum_f% (Merchant 4.14 and newer - formatted product base + attribute prices X quantity)

%list_attributes%
%option_desc%
%attr_prompt% %opt_prompt% (Merchant 5.x legacy template layout)
%option_price%
%option_price_f%
%option_extended_price%
%option_extended_price_f%

%list_other%
%other_charge_desc%
%other_charge_price%
%other_charge_price_f%

%list_shipping%
%shipping_charge_desc%
%shipping_charge_price%
%shipping_charge_price_f%

%list_tax%
%tax_charge_desc%
%tax_charge_price%
%tax_charge_price_f%

%payment_module%
%payment_data%

%order_products_subtotal_f% (Merchant 4.x template layout and Merchant 5.x legacy template layout in main body section)
%order_products_weight% (total order weight - Merchant 5.x legacy template layout in main body section)

%Message-ID% This adds a message ID to the header section of the email. Miva Merchant does not include a message ID, as it is up to the server to do that. If your mail server does not insert a message-id, you can create it within the email and pass it to the server. Some spam detectors are rejecting emails without a message ID. This will create a message ID in your emails. It works with both the legacy template and store morph emails as long as it is included in the main section of the template email in the mail manager admin. For store morph emails do NOT put it in the page template (it still goes in the mail manager admin screen). This token was added to Mail Manager version 5.090. Do not use this token if your mail server does create a message-id.



Use of the "ifvar" script: The script contains three sections. The ifvar command is the first section. ifvar is case sensitive. The second section contains the variable which must exist and have value in order for the third section to echo output to the screen. The third section is a string with a replacement token for the variable which is evaluated in section two. This replacement token is surrounded with the * character. If the variable value is nil, none of the string will appear. Here are three examples using the "ifvar" script. The first two evaluate the value in an open database set to the current record. The third script evaluates the value of a global variable which is created earlier in the main merchant.mvc program as it runs.

%ifvar|Customers.d.login|Please use this Customer ID on future visits: *Customers.d.login*%
%ifvar|AffiliateSession.d.affil_code|Affiliate: *AffiliateSession.d.affil_code*%
%ifvar|taxexempt|Tax exempt: *taxexempt*%

or in Merchant 5.x
%ifvar|customer_login|Customer Login: *customer_login*%
%ifvar|AffiliateSession_affil_code|Affiliate: *AffiliateSession_affil_code*%


Use of the "var" token: If you know a specific variable exists at runtime, you can display the value of that variable. If the value is nil, there will be no visible output to the screen for that variable.

%var|taxexempt%



Use of the "timeset" token: You can change the time zone that will be used for certain tokens in the body of the email. The value can be plus or minus to offset from the time the server is using. If you do not use this token, the mail will include the date and time reported by the server. The tokens this timeset token effects are: %order_date_yyyymmdd%, %order_date_yyyy%, %order_date_mm%, %order_date_dd%, %order_time_hh%, %order_time_mm%, %order_time_ss%

%timeset|-5%



Use of module related tokens: If the third party module contains the function "TemplatePages_Token" and has a return value for the CIM_TOKENS, you can insert that return value directly into the email template. An example function in the Addendum module looks like:

<MvFUNCTION NAME="TemplatePages_Token" PARAMETERS="module,pos" STANDARDOUTPUTLEVEL="">
 <MvIF EXPR = "{(l.module EQ 'CIM_TOKENS') AND (l.pos EQ '2')}">
  <MvASSIGN NAME = "l.showresponses" VALUE = "{Display_Responses_H('off')}">
 </MvIF>
 <MvFUNCTIONRETURN VALUE = "{l.showresponses}">
</MvFUNCTION>

That function can be called from the Mail Manager template using the token:

%module|addendum|2%



Use of custom customer and product fields: If you have Mail Manager version 5.034 or newer, you can insert tokens to display the custom customer and product fields in the legacy template layout order emails. The customer fields can be displayed in the main body and the product fields in the product section. The custom fields need to be created with the built-in custom fields module that Miva Corp supplies with Miva Merchant. The custom customer fields are only used if the customer creates an account. So if your store has optional account creation, those fields may not be displayed.

Example of customer field in the main body section:
%custom:addr2%

Example of product field in the product section:
%custom:author%


Tokens and scripts for the Products Section of the email

Similar to the tokens and scripts in the body, you can use them in the products section. Below are some examples for Merchant 4.x.
%ifvar|Products.d.image|<img src="*Products.d.image*" border=0><BR>%
%ifvar|Products.d.thumbnail|<img src="*Products.d.thumbnail*" border=0><BR>%
%ifvar|OrderItems.d.upsold|(special)%


Limited Tokens for the Main Section of the email in Merchant 4.14-4.24

If your shipping and payment modules are configured with an invoice message, you can display it with:
%payment_invoice_notice%
%shipping_invoice_notice%

We have included the configurable message in our PayPal and Purchase Order Plus payment modules. We have also included the capability in our Minimum or Subtotal Shipping by ZIP Code Zone. We will be adding it to other shipping modules as time permits.


Require a specific variable to allow the email to be sent

If you want to check for the existance of a variable before sending the email, you can use the "require" token in the main body of the template layout email:
%require|question2%

This would require that the customer checked a box or selected an option so that question2 would have a value or the email would not be sent. Put the require token at the beginning of the main mail body in the template layout section. This does not work with vertical or horizontal layouts.

You can have a value parameter in this token. If you create a require token in the format
%require|question2~xyz%
the value of the variable question2 would need to be xyz. If it is not, the email would not be sent.


Character set token

Beginning with Mail Manager version 5.0690 the default character set for the email is iso-8859-1. If your store uses a different character set, e.g. utf-8, then you can change it using a token. If you include the token %charset|utf-8% in the main body section of the template layout email, it will switch the character set to the one you specify.




Note: All tokens and script commands are case sensitive. Always test the emails by limiting the product codes to a test product not seen by the public until you are sure that the email is operating properly. If you have a failure and the test order does not show up in order processing, be sure to delete all baskets and pack the store databases. Do not recover unused order numbers.

* tokens require Mail Manager version 4.53 or newer and are used in the template layout