From fff0f467ffa41808bc124928215c634cf38434e8 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Fri, 1 Jan 2021 00:00:36 +0000 Subject: [PATCH] Add mail config --- config.org | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/config.org b/config.org index a315dfd..6a616a6 100644 --- a/config.org +++ b/config.org @@ -1016,3 +1016,63 @@ #+begin_src emacs-lisp (setq backup-by-copying t) #+end_src + +* Mail + Using Mu4e. It requires =mu(1)= tool be set up already. The mu4e + emacs package is bundled with the system package rather than + distributed seperately, so if it's been put somewhere on the + [[help:load-path][load-path]] we'd just need to ~require~ it — this is the case on the + linux distros that I've used. On OpenBSD, though, packages are + installed into =/usr/local/= and =/usr/local/share/emacs/site-lisp= + is not in =load-path=, so we need to add it. + + #+begin_src emacs-lisp + (when (string-match-p "OpenBSD" (shell-command-to-string "uname -a")) + (add-to-list 'load-path "/usr/local/share/emacs/site-lisp")) + (require 'mu4e) + #+end_src + + The folder archived mail gets saved into is determined by + [[help:mu4e-refile-folder][mu4e-refile-folder]]. I prefer to have archived mail stored on the + remote since then it's accessible from every machine. The default is + =/archive=, though, which is outside of any remotes. Easiest thing to + do is hardcode =/wip/archive= as the refile folder. + + #+begin_src emacs-lisp + (setq mu4e-refile-folder "/wip/archive") + #+end_src + + This only really works because I only have one email account I use + with Mu4e. It would archive mail from /all/ accounts onto the wip.sh + mail server. + +** Fetching + Use =offlineimap(1)= (also needs to be set up seperately) to sync the + maildir with the remote server: + + #+begin_src emacs-lisp + (setq mu4e-get-mail-command "offlineimap") + #+end_src + +** Sending + To send mail we first need to set the mail address: + + #+begin_src emacs-lisp + (setq user-mail-address "cdo@wip.sh") + #+end_src + + Then set the sent and drafts folders to inside the remote folder: + + #+begin_src emacs-lisp + (setq mu4e-sent-folder "/wip/sent" + mu4e-drafts-folder "/wip/drafts") + #+end_src + + And finally configure SMTP: + + #+begin_src emacs-lisp + (setq smtpmail-smtp-server "mail.wip.sh" + smtpmail-smtp-service 587 + smtpmail-stream-type 'starttls + send-mail-function 'smtpmail-send-it) + #+end_src