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.6 KiB

Email

/chris/dotfiles/src/commit/76032ea76e6bb062250a35240772feb75c08fdad/docs/images/2021-02-13-example-mu4e.gif

Plain text email delivered via mu1, mu4e2 and mbsync3. I run my own email server4, so your configuration may differ from mine.

Sync

This is the mbsyncrc3 file I use to synchronize my local mail with my server.

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 link

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.

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

Installing the software

Download mbsync3 as part of the isync package on Ubuntu/Debian.

sudo apt install -y isync

Mu4e2 is packaged for Ubuntu/Debian, but has a few dependencies to build for Emacs. I've had a lot of problems on multiple distributions trying to use the packaged versions. I would recommend installing it from source, which I detail here: https://chrishayward.xyz/posts/ https://chrishayward.xyz/posts/installing-mu-mu4e-from-source/

sudo apt install -y mu4e libgmime-3.0-dev libxapian-dev

Indexing

Once mail has been synchronized you need to init, and index it using mu1.

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

Integration

After syncing and indexing the mail is ready for Emacs. Download and install mu4e2 and configure the mail account3.

  • Update every 5 minutes

  • Scale text for all devices

  • Sign outbound mail with GPG key

  • Configure mail account(s)

(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))))))

Keybinding

Create a keybinding to open the mail dashboard with SPC m.

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

Desktop notifications

Receive notifications for incoming mail via the mu4e-alert5 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))

Footnotes