Using Gmail with Mutt
smalldata.tech
smalldata.tech
The one caveat that I should point out (because it's not mentioned in the article) is that you will probably never be fully rid of official Gmail clients. There is still no good mechanism to use some features with Mutt like thread muting, and these are essential to effective email these days. It's also often more convenient to read certain types of email (e.g. messages that are heavy in multimedia) from a client that supports graphics.
My usual habit is to read email in the web client or on mobile, and respond to or compose mail from within Mutt.
I use `collapse-thread` (Esc-v) on long threads I don't care about, but you're right this is less than ideal. New messages in the thread uncollapse it again, and there's no way to persist the collapsed state, so switching mailboxes or restarting mutt loses it.
It works great. Very fast, and it's nice to have a local backup of my email.
I still haven't found any setup that beats it.
Also, one advantage of this is that changes are real-time which means that if I check the gmail app on my phone messages are correctly moved, marked as read etc.
- regex search
- faster actions (like batch delete, mark as read) using tag
- can use my editor to compose. I use emacsclient -nw and it's so easy to copy things from shared buffer.
- very easy to customize, for example, I want to see the timestamp as local time regardless of the sender's timezone, I wrote a smile Go program to do that https://github.com/wujiang/localize_mutt; I also run a cronjob to archive old emails.
text/html; lynx -dump -force_html %s; needsterminal; copiousoutput- Can easily deal with large volumes of email -- quickly tab through unread messages
- Highlights text from previous emails in a thread, making it easy to see who replied to what
- You can also set up highlighting for diffs, making it easy to review attached patches and change snippets
- Powerful search via external indexers (mu, notmuch)
- Keyboard navigation for everything (if you're using vim and tmux, then you're already spending most of your time with your hands on the keyboard, and having to fish for the mouse just to quicky reply to an email starts to feel really slow).
For handling HTML email, I use a two-pronged approach: for most email I use links browser to automatically render HTML as ASCII so I can view it directly in mutt; for email that has images or otherwise cannot be rendered sensibly with links, I have mapped a key to open it in a graphical browser (dwb for fast launching or Firefox+vimperator if I need to deal with login forms, etc).
EDIT: formatting
First, I use ripmime to dump every single attachment to a folder with dated naming - and so if there is an email in pine with an attachment I want to view, I just web browse a simple apache directory listing and click it. It's not sexy, but it's fast and efficient.
Second, I have a terminal PDF reader installed on my system and defined in alpine as a helper app for pdf files. So I cannot read word or excel right in alpine but I can read PDF docs. So that's nice and slick.
Finally, I never actually click links in alpine, but I defined lynx as a web viewer anyway because that allows me to get the very simple "do you want to view this http link ?" prompt from alpine ... which I always say NO to, but not until I have copied the full URL which they display for me. Then I just open it in a browser.
Fairly happy with this setup.
I find the inability to display HTML emails a feature, not a bug.
No, I don't.
Here's my ~/.mailcap file:
text/html; w3m -T text/html
image/gif; gm display -
image/jpg; gm display -
image/eps; gm display -
application/postscript; gm display -
application/pdf; evince /dev/stdin
In mutt's pager view (reading a message), hit "v" to see all the mime parts, j and k to select one, and enter to view it with the associated mailcap command. In my mailcap I'm popping up images in GraphicsMagick, and viewing rendered html pages in w3m. Pretty rare for me when that doesn't cut it -- most mail has a readable plaintext part or a w3m-readable html part.> Maybe some Mutt user can share with me some of the reasons why they like it so much?
It lets me fully reside in "the world of text:"
- I can compose emails in my text editor (vim, like you) instead of a crappy textarea.
- Mutt feels much faster than gmail and other gui mail clients. The keyboard shortcuts are amazing.
- I can use tmux's activity monitor feature as a text-based growl notification for new mail.
- All my mail (300k+ messages over 10+ years) is available locally, offline, in Maildirs. It's searchable and pliable by the unix toolset, enabling all kinds of fun things like [1]. I use and recommend offlineimap.
- Control. Mutt has changed conservatively over the years. You can configure it to your liking, and be reasonably certain it will continue working to your liking. No "New Compose" crap here. Tools like mutt are a great long haul investment.
One thing I find seriously lacking with mutt: the folder-centric message index (instead of tag-centric or search-centric index). You can get by okay with mutt's searching and limiting, but if you're jumping between folders often, it kinda sucks. Reminds me, I need to revisit mutt-kz.
It'll force any given file, or stdin, to be interpreted as HTML. It helps to remember that w3m was originally created as a generic file / directory browser. It's Web capabilities were somewhat incidental, though that's what it's largely used for now.
I haven't used it myself, but there's also https://www.neomutt.org/.
It would be cool if Mutt could be configured to support that, maybe through the w3mimgdisplay command. I think that's how [ranger file browser](https://github.com/ranger/ranger) does it.
For multi-device, I use a MDA[1] on postfix that writes to a maildir, and that's rsynced to my various boxes. When I send, ssh pipes the msg to sendmail on the server, which copies it to the .sent folder.
But overall love mutt and think aerc is a great initiative. Nice to have an inbuilt sidebar too! Beats recompiling mutt with sidebar patches.
How's aerc with gpg, search, offline storage?
Currently, terrible. It doesn't support those things at all. It doesn't even have an email reader, it just lets you browse subjects at the moment. It's very much in dev, and I could use some help :)
I intend to have excellent gpg support, decent search support, and no support for offline storage whatsoever.
mutt -f imaps://imap.gmail.com
[1] https://www.linux.com/learn/tricks-using-desktop-integrated-...