--- /home/users/ovitters/mailer.py	2008-01-06 11:35:04.000000000 +0000
+++ mailer.py	2008-01-06 15:00:11.000000000 +0000
@@ -206,6 +206,8 @@ class MailedOutput(OutputBase):
            % (self.from_addr, string.join(self.to_addrs, ', '), subject)
     if self.reply_to:
       hdrs = '%sReply-To: %s\n' % (hdrs, self.reply_to)
+    for hdrname, hdrvalue in self.cfg.get_headers(group, params).items():
+      hdrs += '%s: %s\n' % (hdrname, hdrvalue)
     return hdrs + '\n'
 
 
@@ -1029,7 +1042,7 @@ class Config:
 
   # The predefined configuration sections. These are omitted from the
   # set of groups.
-  _predefined = ('general', 'defaults', 'maps')
+  _predefined = ('general', 'defaults', 'maps', 'headers')
 
   def __init__(self, fname, repos, global_params):
     cp = ConfigParser.ConfigParser()
@@ -1056,6 +1069,8 @@ class Config:
       self.defaults.diff = self.general.diff
     if not hasattr(self, 'maps'):
       self.maps = _sub_section()
+    if not hasattr(self, 'headers'):
+      self.headers = _sub_section()
 
     # these params are always available, although they may be overridden
     self._global_params = global_params.copy()
@@ -1115,6 +1130,15 @@ class Config:
       cmd.append(part % args)
     return cmd
 
+  def get_headers(self, group, params):
+    headers = {}
+    for optname, value in vars(self.headers).items():
+        if params is not None:
+          value = value % params
+
+        headers[optname] = value
+    return headers
+
   def _prep_maps(self):
     "Rewrite the [maps] options into callables that look up values."
 


