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?
Vmail
It’s as simple as it gets – a vim like interface to Gmail written in Ruby.
Features
- 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
Installation
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:
username: neo@gmail.com password: password name: Neo signature: | -- Sent from TuxDiary. http://tuxdiary.com
Usage
Start Vmail
$ vmail
Check only a label
$ vmail important_label
Search a label
$ vmail important_label to vvip@gmail.com
gmail.vim
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.
Installation
To install on Ubuntu:
$ wget https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh $ chmod +x install.sh $ ./install.sh
Add the following to your ~/.vimrc:
"NeoBundle Scripts----------------------------- if has('vim_starting') if &compatible set nocompatible " Be iMproved endif " Required: set runtimepath+=/home/neo/.vim/bundle/neobundle.vim/ endif " 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. NeoBundleCheck "End NeoBundle Scripts------------------------- let g:gmail_user_name = 'neo@gmail.com'
Notes:
- Replace
/home/neo
with your home directory absolute path in ~/.vimrc - The plugin asks for the password when you fire it. Avoid adding it to plaintext for security
Usage
To check your mails, run the following in vim command mode:
:Gmail
One thought on “Gmail from console”