Intro
mu is a tool for dealing with e-mail messages stored in the Maildir-format, on Unix-like systems. mu’s main purpose is to help you to find the messages you need, quickly; in addition, it allows you to view messages, extract attachments
Prerequisites
- Emacs
- emacs-lisp
- Being comfortable with command line
- Curiosity to try
Why?
G-Mail gives a nice intuitive UI for interacting with mail. There are lots of disadvantages with it.
- Connection to internet
- Bloated, there are too many options.
- Heavy, Every page load on an average transfers ~25MB
- Limited search capabilities,
Gmail settings
Enable IMAP
⚙️ > See all settings > Forwarding and POP/Imap
In IMAP section, Enable IMAP if not enabled.Set Auto Expunge off , Move to trash and save changes. Next up is password, There are 2 ways to go about it depending on 2-Factor authentication status. If 2-Factor is not enabled, then Less Secure App must be enabled. For accounts with 2-Factor enabled, create an App password if you don’t have one.
Installation and Setup
Install
Instructions here will vary from distro to distro.
|
|
|
|
Set Up
Create a file in home directory .mbsyncrc with content below. replace <EMAIL> with your email and <PASSWORD> with your password accordingly.
Having password in plain text is a bad idea if you are on a public machine, even on personal computer. You can use gpg to encrypt password or use password store provided by your distribution.
IMAPAccount account-1
Host imap.gmail.com
User <EMAIL>
Pass "<PASSWORD>"
#AuthMechs LOGIN
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
IMAPStore account-1-remote
Account account-1
MaildirStore account-1-local
Subfolders Verbatim
Path ~/.local/share/mail/<EMAIL>/
Inbox ~/.local/share/mail/<EMAIL>/INBOX
#Flatten .
Channel account-1
#Expunge Both
Master :account-1-remote:
Slave :account-1-local:
Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"
Create Both
SyncState *
MaxMessages 0
ExpireUnread no
mbsync will throw an error if path is not created. Create directories with the command below
|
|
Next up syncing mails. For testing purposes, first time do this from terminal. It may take some time to complete if you have lots of mails.
|
|
Now, We have all the mails in on machine in a local folder. We have to tell mu to index our mails.
For mu older than v1.3.8
|
|
Newer mu version,
|
|
mu4e
Final step, Configure mu4e to read emails. Add the below confurations to init.el
|
|
save file and restart emacs. To launch mu4e, meta(Alt) + x
aka M-x
, type mu4e and enter.
Conclusion & Further reading
For someone like me, who lives in terminal. mu4e is perfect, I recommend reading through manual . I have in the past used neomutt , it is a full-blown email client, Only issue with neomutt is new mails notifications, despite trying several solutions. I couldn’t get it work. mu4e have a package for showing desktop Notifications .