Mutt 是高度可配置的,如果 .muttrc
中的配置变量配置得当,它的工作模式可以以非常灵活的方式进行修改。
在这里,你可以看到一些宏,它们可以帮助你生成签名消息,避免使用 PGP/MIME 标准,并将其发送给不支持这种遵循 PGP/MIME 标准的签名消息的接收者,以及编辑别名文件并在不退出 Mutt 的情况下重新加载它(最后一个宏与 PGP/GnuPG 无关,仅作为示例展示 Mutt 中宏的强大功能)。
可以告诉 Mutt 你想用于 PGP/GnuPG 的按键绑定。即使其中一些选项已经配置好,我们也可以通过修改配置文件来轻松更改或添加其他选项。
在 PGP/MIME 出现之前,消息中的签名包含在消息正文中。这在许多邮件用户代理中是一种非常常见的发送签名消息的形式。
如果我们想这样签名,我们有两种选择,保留消息的 MIME 类型或将其修改为 application/pgp
。
为了在 Mutt 中实现这两种签名形式,我们将以下行添加到 ~/mutt.varios/mutt.macros
文件中。之前,我们必须在 .muttrc
主配置文件中设置此选项文件路径(请参阅 可选配置文件)
macro compose \Cp "F/usr/bin/pgps\ny"
macro compose S "F/usr/bin/pgps\ny^T^Uapplication/pgp; format=text; x-action=sign\n"
现在,按下 <Ctrl>p
或 S
,我们就可以在发送消息之前,将签名包含在光标所在的消息部分中。
与前一种情况相同,但使用 GnuPG。宏是
macro compose \CP "Fgpg --clearsign\ny"
macro compose \CS "Fgpg --clearsign\ny^T^Uapplication/pgp; format=text; x-action=sign\n"
通过将此宏包含在 ~/mutt.varios/macros.mutt
中,你可以使用 vi 编辑别名文件(更改该行可以使用其他编辑器),而无需按下 <Alt>a
退出 Mutt。
macro index \ea "!vi ~/Mail/.alias\n:source =.alias\n"
以下列表来自 Roland Rosenfeld,它展示了更改默认签名/加密软件以及使用 GnuPG 在不使用 PGP/MIME 的情况下进行签名的宏
# ~/Mail/.muttrc.macros
# keyboard configuration file for Mutt-i
# copied, modified and translated from the original:
#
################################################################
# The ultimative Key-Bindings for Mutt #
# #
# (c) 1997-1999 Roland Rosenfeld <roland@spinnaker.rhein.de> #
# #
# $ Id: keybind,v 1.36 1999/02/20 19:36:28 roland Exp roland $ #
################################################################
#
# To use it, add the next line to ~/.muttrc:
# source ~/Mail/.muttrc.macros
#
# Generic keybindings
# (for all the Mutt menus, except the pager!)
# With the next three we can change the encrypting default selected software:
# <ESC>1 to use GnuPG
macro generic \e1 ":set pgp_default_version=gpg ?pgp_default_version\n"\
"Switch to GNU-PG"
# <ESC>2 to use PGP2
macro generic \e2 ":set pgp_default_version=pgp2 ?pgp_default_version\n"\
"Switch to PGP 2.*"
# <ESC>5 to use PGP5
macro generic \e5 ":set pgp_default_version=pgp5 ?pgp_default_version\n"\
"Switch to PGP 5.*"
#NOTE: Be careful with the last backspace at the end of the previous
macros. If you write that line and the next in the same line, do not write
it.
# index, OpMain, MENU_MAIN
# (Main menu)
# The next macro only runs from the main menu (the one that appears when
# you starts Mutt). The keys <CTRL>K permit us to extract the public keys
# from a message if it has (this is known because it has the K letter in
# the message line):
macro pager \Ck ":set pipe_decode pgp_key_version=pgp2\n\e\ek:set pgp_key_version=pgp5\n\e\ek:set pgp_key_version=gpg\n\e\ek:set pgp_key_version=default nopipe_decode\n"\ "Extract PGP keys to PGP2, PGP 5, and GnuPG keyrings"
# pager, OpPager, MENU_PAGER
# (Pager menu)
# It permits the same operations that previous, with the same key combinations,
# but in this case from the pager menu:
macro pager \e1 ":set pgp_default_version=gpg ?pgp_default_version\n"\
"switch to GNUPG"
macro pager \e2 ":set pgp_default_version=pgp2 ?pgp_default_version\n"\
"switch to PGP 2.*"
macro pager \e5 ":set pgp_default_version=pgp5 ?pgp_default_version\n"\
"switch to PGP 5.*"
# compose, OpCompose+OpGerneric, MENU_COMPOSE
# (Compose menu)
# The next operations are used from the compose menu.
# That is, after you have composed your message and you close it to send it,
# just before pressing the "Y" key that allows us to send it to the MTA.
# In this case, we create a menu that appears when you press "P".
# The options in this menu are going to be bound to MENU_PGP. This are the
# main use options (encryption and signing).
bind compose p pgp-menu
# As many programs can't use PGP/MIME (especially from M$), the <CTRL>P key
# will allow us to sign "as in the old times" (Application/PGP):
macro compose \CP "Fgpg --clearsign\ny"
# The next, <CTRL>S will allow us to sign using PGP/MIME with the private key
# that we have defined as default. This macro is not necesary, as we can
# do the same from the "P" menu:
macro compose \CS "Fgpg --clearsign\ny^T^Uapplication/pgp; format=text; x-action=sign\n"
你可以添加更多宏,并且一些其他的宏已经在较新版本的 Mutt 中配置为默认值。其他一些选项包括
要查看激活了哪些其他选项,你必须从你所在的菜单转到帮助菜单 (? )。