summaryrefslogtreecommitdiff
path: root/configurations/index.md
blob: b1c4f72e9b919b7ff6a49db3014555ce9f39a1c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: "aerc-wiki: Configurations"
---

# Custom plain text filter colours

To configure the
[colorize](https://git.sr.ht/~rjarry/aerc/tree/master/item/filters/colorize)
filter to use your preferred colour scheme, you can copy it into your home
directory and edit it as you wish.

You can then call the edited filter by setting the following in your
`aerc.conf`.

```ini
text/plain=awk -f ~/.config/aerc/filters/custom-colorize
```

- [solarized by Shaleen Jain](https://lists.sr.ht/~rjarry/aerc-devel/patches/30119#%3C20220310045758.228592-1-shaleen@jain.sh%3E+filters/colorize)

# Emulating copy-to for the notmuch backend

Currently, the notmuch backend does not support the `copy-to` setting in
`accounts.conf`.

One way to work around this is to leverage `notmuch insert`. It works by
inserting the email being sent in the notmuch database and the maildir backing
it, which can then be synchronized to the remote IMAP server using your
favorite IMAP synchronization software.

The following script illustrates how this can be done. Note that it assumes your
setup uses a directory structure within your main notmuch maildir which consists
of:

- `$account/sent` for the Sent Emails folder
- `$account` is also the account name in [msmtp](https://marlam.de/msmtp/)

```shell
#!/bin/sh
# XXX: This does not handle encryption

# ensure the script ends whenever a command exits with non-zero status
set -e

EMAIL=`mktemp --suffix=.eml /tmp/XXXXXX`
clean_up() {
    rm -f $EMAIL
}

# The account to be used is given as the first argument of this script
account=$1
shift

# ensure clean_up() is called when we exit abnormally
trap 'clean_up' 0 1 2 3 15

# <stdin> of script gets the email, we save temporarily for using it twice
cat >$EMAIL

# First try to send the email, as it can cause more problems (i.e., connection)
# `set -e` prevents the mail from entering the database in case this fails.
# msmtp could be called with args from aerc, but --read-recipients already does the job
msmtp --account=$account --read-recipients --read-envelope-from <$EMAIL

# assumes all maildir accounts are configured with a 'sent' directory
# also make sure to tag it correctly
notmuch insert --folder=$account/sent -inbox -unread +sent <$EMAIL
```

If you call this script `aerc-notmuch-send`, the following can be set in
`accounts.conf` to ensure your emails are copied to your sent folder:

```ini
[myaccount]
from = My Name <my@email>
source = notmuch://YOUR_MAILDIR_PATH/
outgoing = /path/to/aerc-notmuch-send myaccount
```