Emacs - Mu4e

Table of Contents

Introduction

mu4e is an excellent mail client for Emacs whereby sending/getting mails can be carried out in Emacs. For an Emacs user, the deep integration gives rise to great convenience and efficiency. This post provides a brief summary for the utilization of mu4e.

Installation

Dependencies

mu depends on xapian and gmime, which should be installed in advance.

pacman -S xapian-core gmime

mu1

git clone --depth=1 git://github.com/djcb/mu.git
cd mu
autoreconf -i
./configure --prefix=/opt/mu
make
make install
ln -s /opt/mu/bin/mu /usr/local/bin

getmail and procmail

pacman -S getmail procmail

Configuration

getmailrc

[retriever]
type = SimplePOP3SSLRetriever
server = POP_SERVER
port = PORT_NUM
username = USER_NAME
password = PASSWORD

[destination]
type = MDA_external
path = /usr/bin/procmail

[options]
read_all = false
delete = false
verbose = 0
message_log = $HOME/.Mail/getmail.log

~/.procmailrc

MAILDIR=$HOME/.Mail
DEFAULT=$MAILDIR/inbox/
LOGFILE=$MAILDIR/procmail.log
VERBOSE=yes

:0:
* ^(To|Cc): 3GPP_TSG_RAN_WG1@LIST.ETSI.ORG
r1/

:0:
* ^(To|Cc): 3GPP_TSG_RAN_WG1_NR@LIST.ETSI.ORG
r1nr/

:0:
* ^(To|Cc): 3GPP_TSG_RAN@LIST.ETSI.ORG
rp/

~/.emacs.d/init.el

(add-to-list 'load-path "/opt/mu/share/emacs/site-lisp/mu4e")
(require 'mu4e)
(require 'org-mu4e)

(setq user-full-name "NAME"
      user-mail-address "EMAIL_ADDRESS"
      mu4e-compose-signature "SIGNATURE")

(setq mu4e-maildir "~/.Mail"
      mu4e-drafts-folder "/drafts"
      mu4e-sent-folder "/sent"
      mu4e-trash-folder "/trash")

(setq mu4e-headers-fields '((:human-date . 12)
                            (:flags . 6)
                            (:mailing-list . 10)
                            (:from . 22)
                            (:thread-subject)))

(setq message-send-mail-function 'smtpmail-send-it
      smtpmail-default-smtp-server "SMTP_SERVER"
      smtpmail-smtp-server "SMTP_SERVER"
      smtpmail-stream-type 'starttls
      smtpmail-smtp-service PORT_NUM)

(setq mu4e-get-mail-command "getmail --getmaildir=GETMAIL_CONFIG_DIR -r getmailrc")

(setq mail-user-agent 'mu4e-user-agent
      mu4e-user-mail-address-list '("EMAIL_ADDRESS")
      mu4e-completing-read-function (quote completing-read)
      mu4e-confirm-quit nil
      mu4e-attachment-dir "~/Downloads"
      mu4e-html2text-command "w3m -dump -T text/html -M"
      mu4e-use-fancy-chars t
      mu4e-view-show-images t
      mu4e-view-show-addresses t
      mu4e-update-interval 180
      mu4e-change-filenames-when-moving t
      message-kill-buffer-on-exit t
      org-mu4e-convert-to-html t)

~/.authinfo

machine SMTP_SERVER login USER password PASSWORD port PORT_NUM

Others

Create a maildir

mkdir .Mail

Get the mails

getmail --getmaildir=GETMAIL_CONFIG_DIR -r getmailrc

Index the mails

mu index --maildir=~/.Mail

Footnotes:

1

mu4e is essentially a part of mu.