Gmail from console

Many Linux users are more productive when they work from the terminal. But there’s no denying that many of them use web based services like email regularly for communication. Gmail is undoubtedly the most popular email service available today. We were looking for ways to access Gmail from the console. There’s Mutt, which is a fantastic email client, but how about some other options which programmers may like, especially the vim lovers?


It’s as simple as it gets – a vim like interface to Gmail written in Ruby.


  • Contact auto-completion
  • Starring, deleting, archiving, marking spam, marking read/unread
  • Compose messages and print
  • Checking for new messages, INBOX polling
  • Switching mailboxes, moving messages, copying messages to another mailbox
  • Limited attachment handling support
  • Opening hyperlinks and HTML parts in your web browser
  • Search queries
  • Use with MacVim or gvim
  • Customize colours
  • Secured password tranasfer using TLS encryption


Vmail needs vim (v7.3 and above) and Ruby (v1.9.2 and above). It also needs a text-mode bowser like w3m or elinks to view HTML parts. we will use elinks.

Run the following commands on Ubuntu:

$ sudo apt-get install vim ruby gem libsqlite3-dev sqlite3 elinks
$ sudo gem install vmail

Before you start Vmail for the first time, make sure that you have enabled IMAP in Gmail. Add the following to your .bash_profile for using elinks:

export VMAIL_HTML_PART_READER='elinks -dump'

The Vmail configuration file is ~/.vmailrc and the contents should be something like:

password: password
name: Neo
signature: |
  Sent from TuxDiary.


Start Vmail

$ vmail

Check only a label

$ vmail important_label

Search a label

$ vmail important_label to


Unlike Vmail, gmail.vim is not an application, it is a plugin for the vim editor to view Gmail within the editor. This tool also needs IMAP to be enabled in Gmail. One advantage of gvim.vim is it supports Two Factor Authentication.


To install on Ubuntu:

$ wget
$ chmod +x
$ ./

Add the following to your ~/.vimrc:

"NeoBundle Scripts----------------------------- 
if has('vim_starting')
 if &compatible
 set nocompatible " Be iMproved

 " Required:
 set runtimepath+=/home/neo/.vim/bundle/neobundle.vim/

" Required:
call neobundle#begin(expand('/home/neo/.vim/bundle'))

" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'

" Add or remove your Bundles here:
NeoBundle 'yuratomo/gmail.vim'

NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\ 'windows' : 'tools\\update-dll-mingw',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'linux' : 'make',
\ 'unix' : 'gmake',
\ },
\ }

" Required:
call neobundle#end()

" Required:
filetype plugin indent on

" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
"End NeoBundle Scripts-------------------------

let g:gmail_user_name = ''


  1. Replace /home/neo with your home directory absolute path in ~/.vimrc
  2. The plugin asks for the password when you fire it. Avoid adding it to plaintext for security


To check your mails, run the following in vim command mode:


One thought on “Gmail from console”

Leave a Reply

Your email address will not be published. Required fields are marked *