MH-E supports the concept of multiple personalities or identities. This means that you can easily have a different header and signature at home and at work.
A couple of commands are used to insert identities in MH-Letter mode which are also found in the ‘Identity’ menu.
Insert fields specified by given identity (mh-insert-identity
).
Insert custom fields if recipient found in mh-auto-fields-list
(mh-insert-auto-fields
).
The ‘mh-identity’ customization group contains the following options.
mh-auto-fields-list
List of recipients for which header lines are automatically inserted
(default: nil
).
mh-auto-fields-prompt-flag
On means to prompt before sending if fields inserted (default: ‘on’)
mh-identity-default
Default identity to use when mh-letter-mode
is called (default:
‘None’).
mh-identity-handlers
Handler functions for fields in mh-identity-list
.
mh-identity-list
List of identities (default: nil
).
Some of the common header fields that people change depending on the context are the ‘From:’ and ‘Organization:’ fields, as well as the signature.
This is done by customizing the option mh-identity-list
. In the
customization buffer for this option, click on the ‘INS’ button
and enter a label such as ‘Home’ or ‘Work’. Then click on
the ‘INS’ button with the label ‘Add at least one item
below’. The ‘Value Menu’ has the following menu items:
Specify an alternate ‘From:’ header field. You must include a valid email address. A standard format is ‘First Last <login@host.domain>’. If you use an initial with a period, then you must quote your name as in ‘"First I. Last" <login@host.domain>’.
People usually list the name of the company where they work here.
Set any arbitrary header field and value here. Unless the header field is a standard one, precede the name of your field’s label with ‘X-’, as in ‘X-Fruit-of-the-Day:’.
This value overrides the setting of
mh-extract-from-attribution-verb
. See Inserting Letter.
Set your signature with this item. You can specify the contents of
mh-signature-file-name
, a file, or a function.
See Signature.
Specify a different key to sign or encrypt messages.
You can select the identities you have added via the menu called
‘Identity’ in the MH-Letter buffer. You can also use C-c
C-d (mh-insert-identity
). To clear the fields and signature
added by the identity, select the ‘None’ identity.
The ‘Identity’ menu contains two other items to save you from
having to set the identity on every message. The menu item ‘Set
Default for Session’ can be used to set the default identity to the
current identity until you exit Emacs. The menu item ‘Save as
Default’ sets the option mh-identity-default
to the current
identity setting. You can also customize the option
mh-identity-default
in the usual fashion. If you find that you
need to add another identity, the menu item ‘Customize
Identities’ is available for your convenience.
The option mh-auto-fields-list
can also be used to set the
identity depending on the recipient to provide even more control. To
customize mh-auto-fields-list
, click on the ‘INS’ button
and enter a regular expression for the recipient’s address
(see the section
Syntax of Regular Expressions in
The GNU Emacs Manual).
Click on the ‘INS’ button with the ‘Add at least one item
below’ label. The ‘Value Menu’ contains the following menu items:
Select an identity from those configured in mh-identity-list
.
All of the information for that identity will be added if the
recipient matches.
Insert an ‘Fcc:’ header field with the folder you provide. When you send the message, MH will put a copy of your message in this folder.
Insert an ‘Mail-Followup-To:’ header field with the recipients you provide. If the recipient’s mail user agent supports this header field46, then their replies will go to the addresses listed. This is useful if their replies go both to the list and to you and you don’t have a mechanism to suppress duplicates. If you reply to someone not on the list, you must either remove the ‘Mail-Followup-To:’ field, or ensure the recipient is also listed there so that he receives replies to your reply.
Other header fields may be added using this menu item.
These fields can only be added after the recipient is known. Because
you can continue to add recipients as you edit the draft, MH-E waits
until the message is sent to perform the auto-insertions. This seems
strange at first, but you’ll get used to it. There are two ways to
help you feel that the desired fields are added. The first is the
action when the message is sent: if any fields are added
automatically, you are given a chance to see and to confirm these
fields before the message is actually sent. You can do away with this
confirmation by turning off the option
mh-auto-fields-prompt-flag
. The second method is manual: once
the header contains one or more recipients, you may run the command
C-c M-d (mh-insert-auto-fields
) or choose the
‘Identity -> Insert Auto Fields’ menu item to insert these fields
manually. However, if you use this command, the automatic insertion
when the message is sent is disabled.
You should avoid using the same header field in
mh-auto-fields-list
and mh-identity-list
definitions
that may apply to the same message as the result is undefined.
The option mh-identity-handlers
is used to change the way that
fields, signatures, and attributions in mh-identity-list
are
added. To customize mh-identity-handlers
, replace the name of
an existing handler function associated with the field you want to
change with the name of a function you have written. You can also
click on an ‘INS’ button and insert a field of your choice and
the name of the function you have written to handle it.
The ‘Field’ field can be any field that you’ve used in your
mh-identity-list
. The special fields ‘:attribution-verb’,
‘:signature’, or ‘:pgg-default-user-id’ are used for the
mh-identity-list
choices ‘Attribution Verb’,
‘Signature’, and ‘GPG Key ID’ respectively.
The handler associated with the ‘:default’ field is used when no other field matches.
The handler functions are passed two or three arguments: the field itself (for example, ‘From’), or one of the special fields (for example, ‘:signature’), and the action ‘'remove’ or ‘'add’. If the action is ‘'add’, an additional argument containing the value for the field is given.