]> git.notmuchmail.org Git - notmuch/blob - doc/man5/notmuch-hooks.rst
Merge tag '0.31.4'
[notmuch] / doc / man5 / notmuch-hooks.rst
1 =============
2 notmuch-hooks
3 =============
4
5 SYNOPSIS
6 ========
7
8 <hook_dir>/{pre-new, post-new, post-insert}
9
10 DESCRIPTION
11 ===========
12
13 Hooks are scripts (or arbitrary executables or symlinks to such) that
14 notmuch invokes before and after certain actions. These scripts reside
15 in a directory defined as described in **notmuch-config(1)**. They
16 must have executable permissions.
17
18 The currently available hooks are described below.
19
20 **pre-new**
21     This hook is invoked by the **new** command before scanning or
22     importing new messages into the database. If this hook exits with
23     a non-zero status, notmuch will abort further processing of the
24     **new** command.
25
26     Typically this hook is used for fetching or delivering new mail to
27     be imported into the database.
28
29 **post-new**
30     This hook is invoked by the **new** command after new messages
31     have been imported into the database and initial tags have been
32     applied. The hook will not be run if there have been any errors
33     during the scan or import.
34
35     Typically this hook is used to perform additional query-based
36     tagging on the imported messages.
37
38 **post-insert**
39     This hook is invoked by the **insert** command after the message
40     has been delivered, added to the database, and initial tags have
41     been applied. The hook will not be run if there have been any
42     errors during the message delivery; what is regarded as successful
43     delivery depends on the ``--keep`` option.
44
45     Typically this hook is used to perform additional query-based
46     tagging on the delivered messages.
47
48 SEE ALSO
49 ========
50
51 **notmuch(1)**,
52 **notmuch-config(1)**,
53 **notmuch-count(1)**,
54 **notmuch-dump(1)**,
55 **notmuch-insert(1)**,
56 **notmuch-new(1)**,
57 **notmuch-reply(1)**,
58 **notmuch-restore(1)**,
59 **notmuch-search(1)**,
60 **notmuch-search-terms(7)**,
61 **notmuch-show(1)**,
62 **notmuch-tag(1)**