Revision 7 as of 2012-02-28 13:58:20

Clear message

4.48. How can I change the HTML (or .txt) templates used by my mailing lists?

From the web interface:

If you click on "Edit the public HTML pages and text files" under "Other Administrative Activities" on the upper right hand side of the logged in admin page, you can edit the following from the web interface:

  • General list information page
  • Subscribe results page
  • User specific options page
  • Welcome email text file

The direct link to this editing page will look something like http://EXAMPLE.COM/mailman/edithtml/LISTNAME where you replace the sections in caps with your web domain and listname, respectively.

From the server:

Richard Barrett has answered this question in two excellent messages on the mailman-users mailing list. See http://mail.python.org/pipermail/mailman-users/2004-June/037497.html and http://mail.python.org/pipermail/mailman-users/2004-June/037650.html.

Summarizing from these messages:

The archiver maintains a template cache, so if you create edited versions of any archive related templates, you need to restart Mailman to get the qrunner to restart so that it will rebuild its template cache and in the process pick up new or changed templates.

Non-archive related templates are not cached so any edits or new domain or list specific templates will be effective immediately without a restart.

Note that /bin/arch always starts with its own empty template cache each time it runs.

Also:

You should put your site and list specific changes as described in these comments form $prefix/Mailman/Utils.py:

     # Make some text from a template file.  The order of searches depends on
     # whether mlist and lang are provided.  Once the templatefile is found,
     # string substitution is performed by interpolation in `dict'.  If `raw'
     # is false, the resulting text is wrapped/filled by calling wrap().
     #
     # When looking for a template in a specific language, there are 4 places
     # that are searched, in this order:
     #
     # 1. the list-specific language directory
     #    lists/<listname>/<language>
     #
     # 2. the domain-specific language directory
     #    templates/<list.host_name>/<language>
     #
     # 3. the site-wide language directory
     #    templates/site/<language>
     #
     # 4. the global default language directory
     #    templates/<language>
     #
     # The first match found stops the search.  In this way, you can specialize
     # templates at the desired level, or, if you use only the default
     # templates, you don't need to change anything.  You should never modify
     # files in the templates/<language> subdirectory, since Mailman will
     # overwrite these when you upgrade.  That's what the templates/site
     # language directories are for.
     #
     # A further complication is that the language to search for is determined
     # by both the `lang' and `mlist' arguments.  The search order there is
     # that if lang is given, then the 4 locations above are searched,
     # substituting lang for <language>.  If no match is found, and mlist is
     # given, then the 4 locations are searched using the list's preferred
     # language.  After that, the server default language is used for
     # <language>.  If that still doesn't yield a template, then the standard
     # distribution's English language template is used as an ultimate
     # fallback.  If that's missing you've got big problems. ;)

In http://mail.python.org/pipermail/mailman-users/2004-October/040452.html, Mark Sapiro notes:

 If you want the "Subscribe results page" it is subscribe.html and
 it can also be edited via the lists "Edit the public HTML pages" link.

 If you want the e-mail welcome message, it's subscribeack.txt.

The monthly password reminder template is cronpass.txt, and it is sent without a list context so a list specific version of this template will not work, even if the list is the site list.

Converted from the Mailman FAQ Wizard

This is one of many Frequently Asked Questions.


Comments

S Page

Is it possible to change a message display template so that its <pre> tag has the CSS white-space property that makes long lines wrap to fit the browser window in all modern browsers?!  I filed bug 2074453 on this issue and http://www.skierpage.com/moz_bugs/pre_wrap_test.html has the modified HTML.

(I'm just a Mailman reader.)

Mark Sapiro

A fix has been committed on the 2.2 branch as noted at https://bugs.launchpad.net/mailman/+bug/266467. As a list member, all you can do is ask the Mailman site admins at the sites that host the lists you read to modify the article.html template with the mods indicated in the bug report, place the modified template(s) in templates/site/<language>/article.html and restart Mailman.

Update: As of Mailman 2.1.13, this is in the standard distribution.