Gmail in linux terminal (with Mutt)

mutt-whiteMutt is a light-weight and powerful mail client for unix-like systems. You have to install it with goobook to manage gmail in your linux user terminal (Debian users can download packages from Kevin’s goobook page and follow the debian wiki on mutt).
After the installation, you should create a cache typing in user terminal:

mkdir -p ~/.mutt/cache/{bodies,headers}

Create ~/.mutt/muttrc with the following lines:

# Name Info
set realname = "User Name"
set from = "username@gmail.com"

# IMAP Settings
set imap_user = username@gmail.com
set imap_pass = `grep 'Gmail' ~/Private/passwords.txt | awk '{print $2}'`
set folder = imaps://imap.gmail.com
set imap_check_subscribed

# SMTP Settings
set smtp_url=smtps://$imap_user@smtp.gmail.com
set smtp_pass = `grep 'Gmail' ~/Private/passwords.txt | awk '{print $2}'`

# keep imap connection alive by polling intermittently (time in seconds)
set imap_keepalive = 900

# set timeout (time in seconds)
set timeout = 600

# how often to check for new mail (time in seconds)
set mail_check = 5

# Folders
mailboxes = "+INBOX"
set spoolfile = "+INBOX"
set postponed = "+[Gmail]/Drafts"
set record = /dev/null

# Need trash patch for this to work
set trash = "+[Gmail]/Trash"

# store message headers locally to speed things up
set header_cache = ~/.mutt/cache/headers

# how about store messages too
set message_cachedir =~/.mutt/cache/bodies

# Mailcap (autoexecute program declarations)
set mailcap_path = ~/.mutt/mailcap

# Auto display html
set implicit_autoview
auto_view text/html application/x-pgp-message

# Archive Messages (A) and some other nifty commands
bind editor noop #fix for spaces in names of folders
macro index,pager A "unset trash\n " "Gmail archive message"
macro index,pager gi "=INBOX" "Go to inbox"
macro index,pager ga "=[Gmail]/All Mail" "Go to all mail"
macro index,pager gs "=[Gmail]/Sent Mail" "Go to starred messages"
macro index,pager gd "=[Gmail]/Drafts" "Go to drafts"
macro pager \cu |urlview\n

# Goobook query (google contacts)
set query_command="goobook query '%s'"
bind editor \t complete-query

# Add contacts to google
macro index,pager a "goobook add" "add the sender address to Google contacts"

# Reload goobook db
macro index,pager gr "!goobook reload\n" "Goobook reload"

# Dont request to move messages
set move = no

# Auto include copy of original message when you reply
set include = yes

# Thread Sort (Top = newest messages)
set sort = threads
set sort_aux = 'reverse-last-date-received'

# Unset Markers (don't add + signs if message wraps)
unset markers

# allow mutt to open new imap connection automatically
unset imap_passive

# Colors (transparent background)
color error brightred white
color indicator brightyellow red
color status brightgreen blue
color search white black

Create ~/.mutt/mailcap with the following lines:

text/html; lynx -dump -force_html %s; needsterminal; copiousoutput;
image/*; feh -F %s;
application/pdf; evince %s;

Create ~/.netrc with the following lines:

machine google.com
login username@gmail.com
password user-password

Type mutt and test once the address-book: just start an email and hit the tab key to query the contact database. Edit ~/.netrc and replace your user-password with “”, so that your password will be no longer in the .netrc file.

For further readings:

About these ads

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...

Iscriviti

Ricevi al tuo indirizzo email tutti i nuovi post del sito.

%d blogger cliccano Mi Piace per questo: