--- /dev/null
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+
+<!--
+
+Process this file with an XSLT processor: `xsltproc \
+-''-nonet /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\
+manpages/docbook.xsl manpage.dbk'.  A manual page
+<package>.<section> will be generated.  You may view the
+manual page with: nroff -man <package>.<section> | less'.  A
+typical entry in a Makefile or Makefile.am is:
+
+DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\
+manpages/docbook.xsl
+XP=xsltproc -''-nonet
+
+manpage.1: manpage.dbk
+        $(XP) $(DB2MAN) $<
+    
+The xsltproc binary is found in the xsltproc package.  The
+XSL files are in docbook-xsl.  Please remember that if you
+create the nroff version in one of the debian/rules file
+targets (such as build), you will need to include xsltproc
+and docbook-xsl in your Build-Depends control field.
+
+-->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>Martin F.</firstname>">
+  <!ENTITY dhsurname   "<surname>Krafft</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>September 30, 2007</date>">
+  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+       allowed: see man(7), man(1). -->
+  <!ENTITY dhsection   "<manvolnum>1</manvolnum>">
+  <!ENTITY dhemail     "<email>madduck@madduck.net</email>">
+  <!ENTITY dhusername  "martin f. krafft">
+  <!ENTITY dhucpackage "<refentrytitle>MAILPLATE</refentrytitle>">
+  <!ENTITY dhpackage   "mailplate">
+
+  <!ENTITY debian      "<productname>Debian</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <copyright>
+      <year>2007</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhpackage;</refname>
+
+    <refpurpose>reformat mail drafts according to templates</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhpackage;</command>
+      <group>
+        <arg choice="plain">
+         <group>
+           <arg choice="plain"><option>--auto</option></arg>
+           <arg choice="plain"><option>-a</option></arg>
+         </group>
+        </arg>
+        <arg choice="plain">
+         <group>
+           <arg choice="plain"><option>--menu</option></arg>
+           <arg choice="plain"><option>-m</option></arg>
+         </group>
+        </arg>
+      </group>
+      <group>
+        <arg choice="plain">
+          <group>
+           <arg choice="plain"><option>--new</option></arg>
+           <arg choice="plain"><option>-n</option></arg>
+          </group>
+          <arg choice="plain">
+          </arg>
+          <group>
+           <arg choice="plain"><option>--editor</option></arg>
+           <arg choice="plain"><option>-e</option></arg>
+          </group>
+        </arg>
+      </group>
+      <group>
+       <arg choice="plain"><option>--keep-unknown</option></arg>
+       <arg choice="plain"><option>-k</option></arg>
+      </group>
+      <group>
+       <arg choice="plain"><option>--verbose</option></arg>
+       <arg choice="plain"><option>-v</option></arg>
+      </group>
+      <group>
+       <arg choice="plain"><option>--debug</option></arg>
+       <arg choice="plain"><option>-d</option></arg>
+      </group>
+      <arg choice="plain"><replaceable>message file</replaceable></arg>
+    </cmdsynopsis>
+    <cmdsynopsis>
+      <command>&dhpackage;</command>
+      <group>
+        <arg choice="plain">
+         <group>
+           <arg choice="plain"><option>--auto</option></arg>
+           <arg choice="plain"><option>-a</option></arg>
+         </group>
+        </arg>
+        <arg choice="plain">
+         <group>
+           <arg choice="plain"><option>--menu</option></arg>
+           <arg choice="plain"><option>-m</option></arg>
+         </group>
+        </arg>
+      </group>
+      <group>
+       <arg choice="plain"><option>--keep-unknown</option></arg>
+       <arg choice="plain"><option>-k</option></arg>
+      </group>
+      <group>
+       <arg choice="plain"><option>--verbose</option></arg>
+       <arg choice="plain"><option>-v</option></arg>
+      </group>
+      <group>
+       <arg choice="plain"><option>--debug</option></arg>
+       <arg choice="plain"><option>-d</option></arg>
+      </group>
+      <arg choice="plain"><replaceable>< message data</replaceable></arg>
+    </cmdsynopsis>
+    <cmdsynopsis>
+      <command>&dhpackage;</command>
+      <group>
+       <arg choice="plain"><option>--help</option></arg>
+       <arg choice="plain"><option>-h</option></arg>
+      </group>
+    </cmdsynopsis>
+    <cmdsynopsis>
+      <command>&dhpackage;</command>
+      <group>
+       <arg choice="plain"><option>--version</option></arg>
+       <arg choice="plain"><option>-V</option></arg>
+      </group>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para><command>&dhpackage;</command> is a programme that reformats mail
+      drafts according to a given template. The template may be specified on
+      the command line, but mailplate can also use control information from
+      the template files to automatically select an appropriate template
+      (<option>--auto</option>). A selection menu feature is planned
+      (<option>--menu</option>). </para>
+
+    <para> Applying a template means obtainined select data from an existing
+      mail message (unless <option>--new</option> is specified) and to fill it
+      into appropriate slots in the template. Messages are processed in three
+      parts: headers, body, and signature. </para>
+
+    <para> When <option>--new</option> is given, an empty instantiation of the
+      template is written to stdout. At the moment, <option>--new</option>
+      cannot be combined with <option>--editor</option>.</para>
+
+    <para> The template can define two types of headers: mandatory and
+      preservatory. Mandatory headers take precedence over headers in the
+      existing message and thus overwrite them. Preservatory headers instruct
+      mailplate to port their data from the existing mail message. Headers in
+      the existing message but not defined in the template are dropped, unless
+      <option>--keep-unknown</option> is given. </para>
+
+    <para> Body and signature are separated by '-- '. If this sentinel is not
+      found, no signature is extracted. Templates can be interpolated and data
+      filled into slots. Helper slots are filled with the output of helper
+      commands (which must be defined in the configuration), environment
+      variable slots are just that, and mail variable slots can be filled with
+      data obtained by running regexps or commands over the message. </para>
+
+    <para> This script can be run in multiple ways: </para>
+
+    <itemizedlist>
+      <listitem><para> As a filter, it applies a template to data from stdin
+          and writes the result to stdout. </para></listitem>
+
+      <listitem><para> Given a file, it modifies the file, unless it cannot
+          write to the file, in which case it writes to stdout.
+          </para></listitem>
+
+      <listitem><para> When <option>--editor</option> is passed, the script
+          spawns <command>sensible-editor</command> on the result. It may thus
+          be used as the editor for your mail user agent. </para></listitem>
+
+    </itemizedlist>
+
+  </refsect1>
+
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <para> These programs follow the usual &gnu; command line syntax, with
+      long options starting with two dashes (`--'): </para>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>--auto</option>,
+         <option>-a</option>
+        </term>
+        <listitem>
+         <para>Turn on template auto-discovery.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>--menu</option>,
+         <option>-m</option>
+        </term>
+        <listitem>
+         <para>Choose from a list of templates (not yet implemented)</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>--new</option>,
+         <option>-n</option>
+        </term>
+        <listitem>
+         <para>Create a new message.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>--editor</option>,
+         <option>-e</option>
+        </term>
+        <listitem>
+         <para>Spawn editor once template is applied.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>--keep-unknown</option>,
+         <option>-k</option>
+        </term>
+        <listitem>
+         <para>Preserve mail headers not specified in template.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>--verbose</option>,
+         <option>-v</option>
+        </term>
+        <listitem>
+         <para>Write informational messages to stderr.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>--debug</option>,
+         <option>-d</option>
+        </term>
+        <listitem>
+         <para>Start a debugger after initialisation.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+       <term>
+         <option>--help</option>,
+         <option>-h</option>
+       </term>
+       <listitem>
+         <para>Show summary of options.</para>
+       </listitem>
+      </varlistentry>
+      <varlistentry>
+       <term>
+         <option>--version</option>,
+         <option>-V</option>
+       </term>
+       <listitem>
+         <para>Show version of program.</para>
+       </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+
+  <refsect1>
+    <title>SEE ALSO</title>
+    <para>/usr/share/doc/mailplate/README</para>
+  </refsect1>
+
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>This manual page was written by &dhusername; &dhemail; with help
+      from Carl Fürstenberg.</para>
+  </refsect1>
+</refentry>
+