I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

4.7 KiB

Mu4e

Plain-text email inside of Emacs.

Setup

Make sure the following dependencies are installed on your system before loading the module. I would recommend against using any distributions pre-packaged version of mu4e1, and instead build it yourself which I detail in this post2:

RUN apt install -y isync libgmime-3.0-dev libxapian-dev

Setting up mbsync

The program that actually synchronizes the emails with the server is mbsync3. Create the configuration file, this is for my personal mail server4, which I host myself, so make sure you write your own.

IMAPStore xyz-remote
Host mail.chrishayward.xyz
User chris@chrishayward.xyz
PassCmd "pass chrishayward.xyz/chris"
SSLType IMAPS

MaildirStore xyz-local
Path ~/.cache/mail/
Inbox ~/.cache/mail/inbox
SubFolders Verbatim

Channel xyz
Master :xyz-remote:
Slave :xyz-local:
Patterns * !Archives
Create Both
Expunge Both
SyncState *

Create symbolic links

The system typically expects to find this file at $HOME/.mbsyncrc, but you may also specify a custom path if launching the command using arguments. I chose to symlink the default location to my repository.

(dotfiles/symlink "~/.emacs.d/config/mbsyncrc"
                  "~/.mbsyncrc")

This repository also contains my personal encrypted auth info, this is required by mbsync3 to sign all of the outbound messages.

(dotfiles/symlink "~/.emacs.d/config/authinfo.gpg"
                  "~/.authinfo.gpg")

First time indexing

Before you can use mu4e1 inside of Emacs, you need to synchronize the mail database, and index it using mu5, the library used by mu4e1 under the hood. Execute these commands in your terminal before loading the module, after that you can do everything inside of Emacs:

RUN mbsync -a
RUN mu init --maildir="~/.cache/mail" --my-address="chris@chrishayward.xyz"
RUN mu index

Config

After syncing and indexing, the mail is ready for Emacs. Include mu4e1 in the configuration by adding the custom built version to the load path, and configure the mail account.

  • Update every 5 minutes

  • Configure mail account(s)

  • Scale text for all devices

  • Sign outbound mail with GPG key

(use-package mu4e
  :load-path "~/.local/source/mu/mu4e/"
  :custom (mu4e-maildir "~/.cache/mail")
          (mu4e-update-interval (* 5 60))
          (mu4e-get-mail-command "mbsync -a")
          (mu4e-compose-format-flowed t)
          (mu4e-change-filenames-when-moving t)
          (message-send-mail-function 'smtpmail-send-it)  
          (mml-secure-openpgp-signers '("37AB1CB72B741E478CA026D43025DCBD46F81C0F"))
          (mu4e-compose-signature (concat "Chris Hayward\n"
                                          "https://chrishayward.xyz\n"))
  :config
  (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
  (setq mu4e-contexts
    (list
      ;; Main
      ;; chris@chrishayward.xyz
      (make-mu4e-context
        :name "Main"
        :match-func
          (lambda (msg)
            (when msg 
              (string-prefix-p "/Main" (mu4e-message-field msg :maildir))))
        :vars
          '((user-full-name . "Christopher James Hayward")
            (user-mail-address . "chris@chrishayward.xyz")
            (smtpmail-smtp-server . "mail.chrishayward.xyz")
            (smtpmail-smtp-service . 587)
            (smtpmail-stream-type . starttls))))))

Desktop notifications

Receive desktop notifications when new mail arrives with the mu4e-alert6 package.

(use-package mu4e-alert
 :after mu4e
 :custom (mu4e-alert-set-default-style 'libnotify)
 :config (mu4e-alert-enable-notifications)
         (mu4e-alert-enable-mode-line-display))

Shortcuts

Open the mu4e1 dashboard with SPC m.

(dotfiles/leader
 "m" '(mu4e :which-key "Mu4e"))

Footnotes