AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 755880
Accepted
Kusalananda
Kusalananda
Asked: 2023-09-06 14:46:04 +0800 CST2023-09-06 14:46:04 +0800 CST 2023-09-06 14:46:04 +0800 CST

根据当前文件夹设置 Mutt 的默认保存文件夹

  • 772

在 Mutt 中,当阅读 文件夹=account1/Unsorted或=account1/Important任何其他子文件夹中的消息时=account1/,我希望默认保存文件夹(按s消息索引时建议的文件夹)为=account1/INBOX。

同样,对于 的子文件夹=account2/,我希望默认保存文件夹是=account2/INBOX等。

我该如何配置 Mutt 来做到这一点?

  • save-hook如果它有一种与文件夹名称匹配的方法(我不认为它有),它似乎会很有用。
  • 如果它有一种设置保存文件夹的方法,它似乎folder-hook会很有用,但是没有可以用钩子设置的保存文件夹设置(有record,但那是用于传出消息的)。
configuration
  • 1 1 个回答
  • 32 Views

1 个回答

  • Voted
  1. Best Answer
    minorChaos
    2023-09-07T18:48:15+08:002023-09-07T18:48:15+08:00

    更新:据报道,使用了以下两行

    folder-hook +account1 unhook save-hook
    folder-hook +account1 save-hook . +account1/INBOX
    

    对每个帐户重复。


    如您所知,Mutt 是通过.muttrc文件配置的。你看man muttrc,其他人的模式都在那里。我也没有在那里看到文件夹模式,但搜索save我在其他地方找到的

     Note that these expandos are supported in "save-hook", "fcc-hook" and "fcc-save-hook", too.
    
    

    以及以上

                  %b     filename of the original message folder (think mailbox)
                  %B     the list to which the letter was sent, or else the folder name (%b).
                  %O     original  save  folder where mutt would formerly have stashed the message: list name or
                         recipient name if not sent to a list
    

    其中一些可能会被使用,但我不知道如何以patterns任何方式匹配固定字符串而不是消息。


    使用 can make procmail(或任何扰乱您收到的邮件的内容)添加自定义标题行并使用-h它进行测试。


    我认为你的解决方案将使用

         folder-hook [!]regexp command
                  When  mutt enters a folder which matches regexp (or, when regexp is preceded by an exclamation
                  mark, does not match regexp), the given command is executed.
    
                  When several folder-hooks match a given mail folder, they are executed in the order  given  in
                  the configuration file.
    

    可能是这样的

    folder-hook account1 unhook *
    folder-hook account1 save-hook ~A   =account1/INBOX
    or
    folder-hook account1      save-hook  ".*"  =account1/INBOX
    folder-hook ^=account1.*  save-hook  ........... ???
    
    
    UPDATE: Reportedly, the following two lines were used as solution (and seem to work)
    folder-hook +account1 unhook save-hook
    folder-hook +account1 save-hook . +account1/INBOX
    # repeated for each separate account
    # Note: We know the documentation for folder-hook says "regexp", but using +account (for some given account) seems to work too for whatever reason
    

    最近的不太可能save-hook优先,所以我添加了 unhook (将其更改为unhook save-hook或任何您测试的工作)

        unhook [ *  | hook-type ]
                  This  command will remove all hooks of a given type, or all hooks when "*" is used as an argu-
                  ment.  hook-type can be any of the -hook commands documented above.
    


    以下信息可能对于具有更简单需求并以某种方式来到此页面的其他用户有用:

         save_address
                  Type: boolean
                  Default: no
    
                  If set, mutt will take the sender's full address when choosing a default folder for  saving  a
                  mail. If $save_name or $force_name is set too, the selection of the Fcc folder will be changed
                  as well.
    
          save_name
                  Type: boolean
                  Default: no
    
                  This  variable  controls how copies of outgoing messages are saved.  When set, a check is made
                  to see if a mailbox specified by the recipient address exists (this is done by searching for a
                  mailbox  in  the  $folder  directory with the username part of the recipient address).  If the
                  mailbox exists, the outgoing message will be saved to that mailbox, otherwise the  message  is
                  saved to the $record mailbox.
    
                  Also see the $force_name variable.
    
    An example:
    set save_address=yes
    


    请告诉我和其他人你是如何解决这个问题的。

    • 1

相关问题

  • 如何使'emacs'缩进与标签完全一样'nano'如何......?

  • 是否可以将配置文件通过管道传输到 hostapd?

  • Xorg Conf:交流电/电池的 NVIDIA 性能设置?

  • 如何确保 /etc/network/interfaces 会启动接口?

  • 在 SSH 上从匹配组中排除用户

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve