Skip to content
Stefan Kangas edited this page Nov 29, 2022 · 1 revision

To use Lieer with notmuch+Emacs, start by following the general installation and configuration instructions. Then see below.

Feel free to edit this page and add any further customizations, tips and tricks that you use.

Sending emails

You can use the lieer as a stand-in for sendmail from Emacs, which will allow you to send emails from notmuch as if they were sent directly from your GMail account. Add this to your init file (update file names to match your setup):

  (setq sendmail-program "gmi")
  (setq message-sendmail-extra-arguments '("send" "--quiet" "-t" "-C" "~/.mail/account.gmail"))

Note that the --quiet argument is necessary because Lieer is verbose by default, and Emacs correctly treats any output from sendmail as an error.

Since your emails will be saved automatically on GMail when sending them with Lieer, you will likely want to turn off saving local copies of outgoing mail. To do this, add the following to your init file:

  ;; Optional: Don't save outgoing mail locally.
  (setq notmuch-fcc-dirs nil)

If the gmi executable is not in your PATH, Emacs will be unable to find it. This could be the case for example when running Lieer from a git repository checked out in your home directory. In this case, you could specify sendmail-program like so:

  (setq sendmail-program (expand-file-name "~/path/to/gmi"))

If using multiple mail accounts you can use a hook. For example with two mail accounts

(add-hook 'message-send-hook (lambda ()
				 (let (from (message-fetch-field "from"))
				   (if (string= from "$FULL_FROM_MAIL")
				       (setq message-sendmail-extra-arguments '("send" "--quiet" "-t" "-C" "$FIRST_MAIL_DIR"))
				     (setq message-sendmail-extra-arguments '("send" "--quiet" "-t" "-C" "$SECOND_MAIL_DIR"))))))

If using more than 2 accounts you can use cond instead of if

Clone this wiki locally