Email from Spacemacs: my mu4e / org-msg / offlineimap setup
Introduction
I wanted to share my configuration for mu4e / org-msg / offlineimap for Spacemacs OSX Catalina using Gmail.
I am very satisfy with the end result (I would like to fix the image loading problem in the near future but for now I use the view in browser to deal with html heavy email). The interface of Mu4e is perfect for my workflow and org-msg make writing email awesome since I can leverage all my org-mode materials that is sitting in my org-wiki and use all the org-mode power goodies.
OfflineIMAP setup
Warning: I had to fight with the security settings in my google account (see Less secure apps & your Google Account - Google Account Help). I had to click on email security warning sent by gmail also.
brew install offlineimap brew services start offlineimap vim ~/.offlineimaprc # see configuration below offlineimap # test if your config work
~/.offlineimaprc
[general] ui=TTYUI accounts = Gmail autorefresh = 5 [Account Gmail] localrepository = Gmail-Local remoterepository = Gmail-Remote [Repository Gmail-Local] type = Maildir localfolders = ~/.Mail/{your-email}@gmail.com [Repository Gmail-Remote] type = Gmail remotehost = imap.gmail.com remoteuser = {your-email}@gmail.com remotepass = {your-password} realdelete = no ssl = yes sslcacertfile = /usr/local/etc/openssl/cert.pem maxconnections = 1 folderfilter = lambda folder: folder not in ['[Gmail]/Trash', '[Gmail]/Spam', '[Gmail]/All Mail',]
Consult the master config for more options: offlineimap/offlineimap.conf at master
Warning: offlineimap will obviously download all of the targeted messages so that might result in a lot of data usage...
Spacemacs Configuration
~/.spacemacs
dotspacemacs-configuration-layers '([...] mu4e [...]) dotspacemacs-additional-packages '(mu4e-alert org-msg) (defun dotspacemacs/user-config () [...] ;; Mu4e ;; https://emacs.stackexchange.com/questions/46156/how-to-install-mu-and-mu4e-with-gui-emacs (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu/mu4e") (require 'mu4e) (setq mu4e-maildir "~/.Mail" mu4e-trash-folder "/Trash" mu4e-refile-folder "/Archive" mu4e-get-mail-command "offlineimap" mu4e-update-interval nil mu4e-compose-signature-auto-include nil mu4e-view-show-images t mu4e-view-show-addresses t) (setq mu4e-enable-mode-line t) (setq mu4e-enable-notifications t) ;; shortcuts (setq mu4e-maildir-shortcuts '(("/INBOX" . ?i))) (require 'smtpmail) (setq message-send-mail-function 'smtpmail-send-it starttls-use-gnutls t smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil)) smtpmail-auth-credentials '(("smtp.gmail.com" 587 "{your-email}@gmail.com" nil)) smtpmail-default-smtp-server "smtp.gmail.com" smtpmail-smtp-server "smtp.gmail.com" smtpmail-smtp-service 587) ;; don't keep message buffers around (setq message-kill-buffer-on-exit t) (setq mu4e-sent-messages-behavior 'delete) (setq mu4e-show-images t) (when (fboundp 'imagemagick-register-types) (imagemagick-register-types)) ;; convert html emails properly ;; Possible options: ;; - html2text -utf8 -width 72 ;; - textutil -stdin -format html -convert txt -stdout ;; - html2markdown | grep -v ' _place_holder;' (Requires html2text pypi) ;; - w3m -dump -cols 80 -T text/html ;; - view in browser (provided below) ;; (setq mu4e-html2text-command "textutil -stdin -format html -convert txt -stdout") (require 'mu4e-contrib) (setq mu4e-html2text-command 'mu4e-shr2text) (add-hook 'mu4e-view-mode-hook (lambda() (local-set-key (kbd "<tab>") 'shr-next-link) (local-set-key (kbd "<backtab>") 'shr-previous-link))) ;; (setq browse-url-browser-function 'eww-browse-url) (setq mu4e-update-interval 60) (setq user-mail-address "{your-email}@gmail.com" user-full-name "{your-name}" mu4e-compose-signature "{your-signature}") (setq mail-user-agent 'mu4e-user-agent) [...])

Org-Msg Configuration
~/.spacemacs
(defun dotspacemacs/user-config () [...] ;; org-msg (require 'org-msg) (setq org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil" org-msg-startup "indent inlineimages" org-msg-greeting-fmt "\nHi *%s*,\n\n" org-msg-greeting-name-limit 3 org-msg-signature " Regards, #+begin_signature -- *{your-name}* \\\\ /Sent from my Emacs/ #+end_signature") (org-msg-mode) [...])

It is possible to change the org-msg style via `org-msg-enforce-css`. The default style look like this:
