Add mail configuration (mu4e)

This commit is contained in:
Camden Dixie O'Brien 2021-01-01 00:00:31 +00:00
parent dfe54f7652
commit e35e461c4a

View File

@ -415,3 +415,68 @@ needs to be set up to install them if they aren't already.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package mingus) (use-package mingus)
#+end_src #+end_src
* Mail
Currently using =mu4e= for mail. Not sure whether this is my 'final'
set up, I might give =notmuch= a try at some point.
=mu4e= is a bit annoying as it's bundled along with =mu= rather than
being loaded from ELPA or MELPA, so it can't be loaded with
=use-package=. Indeed, how to load it depends on how =mu= was
packaged. On NixOS at least, =mu4e= gets put in a place where Emacs
is able to find it, so it just needs to be =require='d.
#+begin_src emacs-lisp
(require 'mu4e)
#+end_src
I'm /sure/ this will break at some point; when it does, probably
makes sense to do something like:
#+begin_src emacs-lisp :tangle no
(let ((uname-output (shell-command-to-string "uname -a")))
(cond ((string-match-p "NixOS" uname-output) nil)
...))
(require 'mu4e)
#+end_src
To get the correct address by default:
#+begin_src emacs-lisp
(setq user-mail-address "cdo@wip.sh")
#+end_src
And to avoid being tickled:
#+begin_src emacs-lisp
(setq mail-host-address "hactar")
#+end_src
** Automatic updating
For updating through =mu4e= to actually work, [[help:mu4e-get-mail-command][mu4e-get-mail-command]]
needs to be set to =offlineimap=. New mail can be then fetched
regularly with [[help:mu4e-update-mail-and-index][mu4e-update-mail-and-index]] using [[help:run-with-timer][run-with-timer]].
#+begin_src emacs-lisp
(setq mu4e-get-mail-command "offlineimap")
(run-with-timer 0 120 (lambda ()
(mu4e-update-mail-and-index t)))
#+end_src
** Mode-line alert
=mu4e-alert= provides a convenient little icon that shows up
whenever =mu4e= has unread mail.
#+begin_src emacs-lisp
(use-package mu4e-alert
:config
(add-hook 'after-init-hook
#'mu4e-alert-enable-mode-line-display))
#+end_src
** Sending with =sendmail=
I have =msmtp= set up so use that to send mail.
#+begin_src emacs-lisp
(setq send-mail-function 'sendmail-send-it)
#+end_src