]> git.notmuchmail.org Git - notmuch/blob - doc/man5/notmuch-hooks.rst
cli/insert: add post-insert hook
[notmuch] / doc / man5 / notmuch-hooks.rst
1 =============
2 notmuch-hooks
3 =============
4
5 SYNOPSIS
6 ========
7
8         $DATABASEDIR/.notmuch/hooks/*
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 the .notmuch/hooks directory within the database directory and must
16 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
23         with a non-zero status, notmuch will abort further processing of
24         the **new** command.
25
26         Typically this hook is used for fetching or delivering new mail
27         to 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
40         This hook is invoked by the **insert** command after the
41         message has been delivered, added to the database, and initial
42         tags have been applied. The hook will not be run if there have
43         been any errors during the message delivery; what is regarded
44         as succesful delivery depends on the ``--keep`` option.
45
46         Typically this hook is used to perform additional query-based
47         tagging on the delivered messages.
48
49 SEE ALSO
50 ========
51
52 **notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,
53 **notmuch-dump(1)**, **notmuch-insert(1)**, **notmuch-new(1)**,
54 **notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**,
55 **notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**