Using Mailmerge For Queries

"Mailmerge For Dummies"

Michael L. Hébert
March 7, 1997
last updated on November 20, 1997


This page is intended to provide a sort of plug-n-play "Mailmerge for Dummies" way of setting up your own query system using Mailmerge.  I have tried to write this page assuming the reader has very little or no knowledge of Mailmerge, so I hope everyone can understand it.  I learned some of the ins and outs of Mailmerge as a novice/newbie/dummy myself.  If anyone sees any errors please contact me.

Attn. CCHelper users - There are special instructions for you throughout this page, so be on the lookout.  You can also check out Sue Abruscato's Mailmerge for CCHelper Users page which is geared toward CCHelper users on Rootsweb.

Getting Started

First of all, you have to make sure that Mailmerge is set up on the system where your web pages reside and you need to know where the mailmerge.cgi file is located (the directory path).  You can contact your ISP or whoever is providing your web space to find out this information (on Rootsweb, Mailmerge is located at "www.rootsweb.com/cgi-bin/local/mailmerge.cgi").  This is information that you will need to use in your html form code (see "Modifying your html form code" below).

Secondly, you will need to have a template file that tells Mailmerge how to handle your queries.  I have provided template files below for the different types of setups that you might want, including a template file for CCHelper users.  I have set up the template files in such a way as to make it less likely that casual visitors, who submit a query using the query form, will try to submit a query twice and more likely that they will make it back to your county home page without any confusion.  I think that many "newbies" get confused when they get to the generic Mailmerge output page after submitting a query and don't quite know where to go from there.  So, they just hit the "back" button on their browser and wind up reposting the same query again.  Click here to see a sample output page of my templates.

I have provided html form code (to be inserted into your own query submission page) and template files (to be uploaded your public html directory) for five different types of setups, including a special setup for CCHelper users:
    1. Queries mailed to you in plain text format
    2. Queries mailed to you in html format
    3. Queries posted to a file in plain text format
    4. Queries posted to a file in html format
    5. CCHelper Users - Queries mailed to you in plain text format
Also, for each type of setup, I have provided versions that either do or don't allow submitters to include their home page URL (I provide this option on my county pages).  If anyone wants, I can also put together forms that provide for a bold surnames line for submitters to input.  For each setup, there are two files you need to download and edit: the html form code and the template file.  Edit these files using a plain text editor such as Notepad.

Modifying your html form code

For the form code file (.txt), you need to simply change "action=" line at the beginning of the file to point to the mailmerge.cgi file and the appropriate template file.  The first part of the line contains the path to the mailmerge.cgi file on your server and the last part of the line contains the path to your template file.  Here is a sample of how that line would look for a Rootsweb site:

<form
  action="http://www.rootsweb.com/cgi-bin/local/mailmerge.cgi/~ilcumber/q2mail_u.tmp"
  method="POST">

This is all you need to change in this file.  Leave the "method=POST" as it is.  You can change some of the other form code if you like, BUT you must leave the "name=" and "type=" specifications as they are or else the template files won't work correctly.  After editing the form code file, cut and paste the whole file into the html file for your query submission page.  You can make this query submission page look like the rest of the pages on your site with the query form integrated into the page.  Click here to see a sample query submission page using this form code.  Go ahead and make a test post to see how the output works.

Modifying your template file

For the template file (.tmp), you need to change some lines near the top of the file that pertain to your particular site.  These lines tell Mailmerge the names, links, and e-mail addresses to use for your site.  There are instructions at the top of each template file.  DO NOT change anything before the equal (=) signs.  Here is a sample showing how these lines would look in a query-to-mail template file (and the CCHelper template file):

    CountyName=Cumberland County

    CountyMainPageURL=http://www.rootsweb.com/~ilcumber/index.htm

    CountyQueryFormPageURL=http://www.rootsweb.com/~ilcumber/qrysubmt.htm

    EMailSubjectLine=Cumberland County Query

    MyName=Michael L. Hébert

    MyEMailReturnAddress=mlhebert@uiuc.edu

Here is a sample showing how these lines would look in a query-to-file template file:

    CountyName=Cumberland County

    CountyMainPageURL=http://www.rootsweb.com/~ilcumber/index.htm

    CountyQueryFormPageURL=http://www.rootsweb.com/~ilcumber/qrysubmt.htm

    QueryFile=/~ilcumber/query01.htm

    MyName=Michael L. Hébert

This all you need to change in the template file.  After editing it, upload it to your main public html directory.  The location of this file will form the last part of the "action=" line that you put in the form code (see above).

Changing file write permissions

If you chose options 1 or 2 (queries by e-mail), you don't have to worry about changing any file write permissions and should be ready to fly.  If you choose options 3 or 4 (queries to file), you will need to upload a blank file to accumulate your queries in.  This file can just have the header info. you want to display on your "View Queries" page.  Also, you will have to know how to change file write permissions on the files you are writing to.  Some users may be able to accomplish this by telnetting to their account using a telnet program (Rootsweb users cannot telnet to their accounts, see below).  Most Windows systems have a generic telnet client called "telnet.exe".  If your web browser is configured for telnet, you can just go to "telnet://myserver".  Here is a sample telnet session that changes the file permissions for "queries.htm":

bl-12 login: ilcumber
Password: mypsswrd
Linux 2.0.28.

bl-12:/home0013/home/ilcumber$ cd public_html
bl-12:/home0013/home/ilcumber/public_html$ chmod go+w queries.htm
bl-12:/home0013/home/ilcumber/public_html$ logout

Most users, including Rootsweb users, will not be able to telnet to their accounts.  So, to change the write permissions on a file, you can do this using WS-FTP or CuteFTP 2.0.  After logging in to your account, with WS-FTP simply right-click on the file in the right hand window (the remote files) and select the "chmod" option, with CuteFTP select the "Commands/Change file attributes" command.  See help topics in your ftp program for more info. (topic "chmod" with WS-FTP, "changing file attributes" with CuteFTP)

Very Important Note - Mailmerge is very picky about how your template files are uploaded to your account.  They must be uploaded in ascii or plain text (not binary) format.  Otherwise, Mailmerge gets confused and reverts to its default settings.  So, if you are having problems setting up Mailmerge, this is very likely the problem.

Downloads for each option

(You can use the right-click on your mouse and then "Save As" to download these files, or whatever way your browser lets you save files.)

1. Queries mailed to you in plain text format

With Submitter URL Option

Form Code File (qform_u.txt)
Template File (q2mail_u.tmp)

Without Submitter URL Option

Form Code File (qform.txt)
Template File (q2mail.tmp)

2. Queries mailed to you in html format

With Submitter URL Option

Form Code File (qform_u.txt)
Template File (q2mhtm_u.tmp)

Without Submitter URL Option

Form Code File (qform.txt)
Template File (q2mhtm.tmp)

3. Queries posted to a file in plain text format

With Submitter URL Option

Form Code File (qform_u.txt)
Template File (q2ftxt_u.tmp)

Without Submitter URL Option

Form Code File (qform.txt)
Template File (q2ftxt.tmp)

4. Queries posted to a file in html format

With Submitter URL Option

Form Code File (qform_uh.txt)
Template File (q2fhtm_u.tmp)

Without Submitter URL Option

Form Code File (qform_h.txt)
Template File (q2fhtm.tmp)

5. CCHelper - Queries mailed to you in plain text format

Includes Submitter URL Option

Form Code File (qform_cch.txt)
Template File (q2mail_cch.tmp)

 

You may take and use these files any way you like including modifying them.  Even though I have tested these files and found them to be functional, I assume no responsibility for any problems arising from their use (customary disclaimer).  If you have any comments or questions, feel free to contact me.  Also, if there are some additional fields you would like to add to your form, I can help you with that too.


For More Information

Using Mailmerge - A technical description of the Mailmerge program.
CCHelper Home Page - Home of Patty Lindsay's County Coordinator's Helper program.
Mailmerge for CCHelper Users - Sue Ambruscato's help page on setting up Mailmerge for CCHelper users.


Michael L. Hébert
March 7, 1997
updated on
October 17, 1997
updated on October 26, 1997
updated on November 20, 1997

visitor.